| 1 |
PyCryptodome |
| 2 |
============ |
| 3 |
|
| 4 |
PyCryptodome is a self-contained Python package of low-level |
| 5 |
cryptographic primitives. |
| 6 |
|
| 7 |
It supports Python 2.7, Python 3.5 and newer, and PyPy. |
| 8 |
|
| 9 |
The installation procedure depends on the package you want the library to be in. |
| 10 |
PyCryptodome can be used as: |
| 11 |
|
| 12 |
#. **an almost drop-in replacement for the old PyCrypto library**. |
| 13 |
You install it with:: |
| 14 |
|
| 15 |
pip install pycryptodome |
| 16 |
|
| 17 |
In this case, all modules are installed under the ``Crypto`` package. |
| 18 |
|
| 19 |
One must avoid having both PyCrypto and PyCryptodome installed |
| 20 |
at the same time, as they will interfere with each other. |
| 21 |
|
| 22 |
This option is therefore recommended only when you are sure that |
| 23 |
the whole application is deployed in a ``virtualenv``. |
| 24 |
|
| 25 |
#. **a library independent of the old PyCrypto**. |
| 26 |
You install it with:: |
| 27 |
|
| 28 |
pip install pycryptodomex |
| 29 |
|
| 30 |
In this case, all modules are installed under the ``Cryptodome`` package. |
| 31 |
PyCrypto and PyCryptodome can coexist. |
| 32 |
|
| 33 |
For faster public key operations in Unix, you should install `GMP`_ in your system. |
| 34 |
|
| 35 |
PyCryptodome is a fork of PyCrypto. It brings the following enhancements |
| 36 |
with respect to the last official version of PyCrypto (2.6.1): |
| 37 |
|
| 38 |
* Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB) |
| 39 |
* Accelerated AES on Intel platforms via AES-NI |
| 40 |
* First class support for PyPy |
| 41 |
* Elliptic curves cryptography (NIST P-curves; Ed25519, Ed448) |
| 42 |
* Better and more compact API (`nonce` and `iv` attributes for ciphers, |
| 43 |
automatic generation of random nonces and IVs, simplified CTR cipher mode, |
| 44 |
and more) |
| 45 |
* SHA-3 hash algorithms (FIPS 202) and derived functions (NIST SP-800 185): |
| 46 |
|
| 47 |
- SHAKE128 and SHA256 XOFs |
| 48 |
- cSHAKE128 and cSHAKE256 XOFs |
| 49 |
- KMAC128 and KMAC256 |
| 50 |
- TupleHash128 and TupleHash256 |
| 51 |
|
| 52 |
* KangarooTwelve, TurboSHAKE128, and TurboSHAKE256 XOFs |
| 53 |
* Truncated hash algorithms SHA-512/224 and SHA-512/256 (FIPS 180-4) |
| 54 |
* BLAKE2b and BLAKE2s hash algorithms |
| 55 |
* Salsa20 and ChaCha20/XChaCha20 stream ciphers |
| 56 |
* Poly1305 MAC |
| 57 |
* ChaCha20-Poly1305 and XChaCha20-Poly1305 authenticated ciphers |
| 58 |
* scrypt, bcrypt, HKDF, and NIST SP 800 108r1 Counter Mode key derivation functions |
| 59 |
* Deterministic (EC)DSA and EdDSA |
| 60 |
* Password-protected PKCS#8 key containers |
| 61 |
* Shamir's Secret Sharing scheme |
| 62 |
* Random numbers get sourced directly from the OS (and not from a CSPRNG in userspace) |
| 63 |
* Simplified install process, including better support for Windows |
| 64 |
* Cleaner RSA and DSA key generation (largely based on FIPS 186-4) |
| 65 |
* Major clean ups and simplification of the code base |
| 66 |
|
| 67 |
PyCryptodome is not a wrapper to a separate C library like *OpenSSL*. |
| 68 |
To the largest possible extent, algorithms are implemented in pure Python. |
| 69 |
Only the pieces that are extremely critical to performance (e.g. block ciphers) |
| 70 |
are implemented as C extensions. |
| 71 |
|
| 72 |
For more information, see the `homepage`_. |
| 73 |
|
| 74 |
For security issues, please send an email to [email protected]. |
| 75 |
|
| 76 |
All the code can be downloaded from `GitHub`_. |
| 77 |
|
| 78 |
.. _`homepage`: https://www.pycryptodome.org |
| 79 |
.. _`GMP`: https://gmplib.org |
| 80 |
.. _GitHub: https://github.com/Legrandin/pycryptodome |