pycryptodome 4.6.0


pip install pycryptodome

  Latest version

Released: Nov 22, 2026


Meta
Author: Helder Eijs
Requires Python: >=3.9

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

Operating System
  • Unix
  • Microsoft :: Windows
  • MacOS :: MacOS X

Topic
  • Security :: Cryptography

Typing
  • Typed

Programming Language
  • Python :: 3
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15
https://github.com/Legrandin/pycryptodome/workflows/Integration%20test/badge.svg https://badge.fury.io/py/pycryptodome.svg

PyCryptodome

PyCryptodome is a self-contained Python package of low-level cryptographic primitives: one pip install, no system libraries, and a broad, consistent API from AES and RSA to HPKE, KangarooTwelve and post-quantum ML-DSA and SLH-DSA.

Post-quantum: ML-DSA (FIPS 204) and SLH-DSA (FIPS 205) signatures, and, in HPKE (RFC 9180), ML-KEM (FIPS 203) and the hybrid X-Wing, as in the draft draft-ietf-hpke-pq.

It supports Python 3.9 and newer, and PyPy.

You install it with:

pip install pycryptodome

All modules are installed under the Crypto package.

from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes

key = get_random_bytes(32)
cipher = AES.new(key, AES.MODE_GCM)         # a random nonce is generated
ciphertext, tag = cipher.encrypt_and_digest(b"attack at dawn")

receiver = AES.new(key, AES.MODE_GCM, nonce=cipher.nonce)
plaintext = receiver.decrypt_and_verify(ciphertext, tag)  # raises ValueError if tampered

Why PyCryptodome

  • Self-contained. No runtime dependencies and no system libraries: all the C code ships with the package, so there is nothing else to install, patch, or keep in sync. Building from source only needs a C compiler. Binary wheels are available for Linux, macOS and Windows, on x86 and ARM, for CPython and PyPy.

  • Broad. Mainstream and specialized algorithms behind one consistent API, including many that are hard to find elsewhere in Python: SIV and OCB modes, AES key wrap (KW, KWP), HPKE, KMAC, TupleHash, TurboSHAKE, KangarooTwelve, Ed448 and X448, AEGIS, ML-DSA, ML-KEM, SLH-DSA, and Shamir’s secret sharing.

  • Easy to use correctly. Authenticated encryption and verification are a single call, nonces and IVs are generated for you, randomness comes straight from the operating system, and keys are imported and exported in the standard formats (PEM, DER, PKCS#8, OpenSSH).

  • Side-channel aware. The big integer arithmetic on private keys runs in constant time, in C. RSA decryption is blinded, and elliptic curve scalar multiplications are blinded and use randomized coordinates.

  • Fast where it counts. AES-NI, CLMUL, the SHA extensions, AVX2 and BMI2/ADX on x86, and the ARMv8 Cryptography Extensions on ARM, are used when the CPU has them, selected at runtime: the same wheel runs everywhere, at full speed on recent hardware. On 64-bit ARM, NEON is always used.

  • Well tested. Checked against the NIST and Wycheproof test vectors, on Linux, macOS and Windows, x86 and ARM, CPython and PyPy.

  • Permissive license. BSD 2-Clause, and public domain for the oldest code.

For the full list of algorithms and formats, see the features page. For everything else, see the homepage.

For security issues, please send an email to security@pycryptodome.org.

All the code can be downloaded from GitHub.

Wheel compatibility matrix

Platform CPython >=3.9 (abi3) CPython (additional flags: t) 3.15 PyPy 3.10 (pp73) PyPy 3.11 (pp80) PyPy 3.12 (pp80)
macosx_10_15_universal2
macosx_10_15_x86_64
macosx_10_9_universal2
macosx_10_9_x86_64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
musllinux_1_2_aarch64
musllinux_1_2_x86_64
win32
win_amd64
win_arm64

Files in release

pycryptodome-4.6.0-cp315-cp315t-macosx_10_15_universal2.whl (1.9MiB)
pycryptodome-4.6.0-cp315-cp315t-macosx_10_15_x86_64.whl (1.7MiB)
pycryptodome-4.6.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (2.7MiB)
pycryptodome-4.6.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.3MiB)
pycryptodome-4.6.0-cp315-cp315t-musllinux_1_2_aarch64.whl (2.8MiB)
pycryptodome-4.6.0-cp315-cp315t-musllinux_1_2_x86_64.whl (4.0MiB)
pycryptodome-4.6.0-cp315-cp315t-win32.whl (1.5MiB)
pycryptodome-4.6.0-cp315-cp315t-win_amd64.whl (1.8MiB)
pycryptodome-4.6.0-cp315-cp315t-win_arm64.whl (1.6MiB)
pycryptodome-4.6.0-cp39-abi3-macosx_10_9_universal2.whl (1.9MiB)
pycryptodome-4.6.0-cp39-abi3-macosx_10_9_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (2.7MiB)
pycryptodome-4.6.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.3MiB)
pycryptodome-4.6.0-cp39-abi3-musllinux_1_2_aarch64.whl (2.8MiB)
pycryptodome-4.6.0-cp39-abi3-musllinux_1_2_x86_64.whl (4.0MiB)
pycryptodome-4.6.0-cp39-abi3-win32.whl (1.4MiB)
pycryptodome-4.6.0-cp39-abi3-win_amd64.whl (1.8MiB)
pycryptodome-4.6.0-cp39-abi3-win_arm64.whl (1.5MiB)
pycryptodome-4.6.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp310-pypy310_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.4MiB)
pycryptodome-4.6.0-pp310-pypy310_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp310-pypy310_pp73-win_amd64.whl (1.8MiB)
pycryptodome-4.6.0-pp311-pypy311_pp80-macosx_10_15_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp311-pypy311_pp80-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.4MiB)
pycryptodome-4.6.0-pp311-pypy311_pp80-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp311-pypy311_pp80-win_amd64.whl (1.8MiB)
pycryptodome-4.6.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp312-pypy312_pp80-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.4MiB)
pycryptodome-4.6.0-pp312-pypy312_pp80-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.6MiB)
pycryptodome-4.6.0-pp312-pypy312_pp80-win_amd64.whl (1.8MiB)
pycryptodome-4.6.0.tar.gz (1.9MiB)
Extras:
Dependencies: