Skip to main content

PQCrypto

Build Status Python Version PyPI Version License

Python bindings for post-quantum cryptography. Wraps well-tested Rust implementations of NIST-standardized and candidate KEM and signature schemes via PyO3/maturin. All variants live in a single compiled wheel.

Installation

pip install pqcrypto

Or build from source:

pip install maturin pytest
maturin develop

Quick Start

The Python API mirrors the Rust crate design: keygen, encaps, decaps (KEM) and keygen, sign, verify (signatures).

KEM — Key Encapsulation

from pqcrypto.kem.ml_kem_512 import keygen, encaps, decaps
from pqcrypto.kem.ml_kem_512 import PublicKey, SecretKey

pk, sk = keygen()
ct, ss = encaps(pk)
assert decaps(sk, ct) == ss

pk_obj = PublicKey(pk)
sk_obj = SecretKey(sk)
ct2, ss2 = pk_obj.encaps()
assert ss2 == sk_obj.decaps(ct2)

Signatures

from pqcrypto.sign.ml_dsa_44 import keygen, sign, verify
from pqcrypto.sign.ml_dsa_44 import PublicKey, SecretKey

pk, sk = keygen()
sig = sign(sk, b"message")
verify(pk, b"message", sig)  # returns None; raises InvalidSignatureError if invalid

# FIPS 204/205 context string:
sig = sign(sk, b"message", b"my-context")
verify(pk, b"message", sig, b"my-context")

# HashML-DSA / HashSLH-DSA pre-hash mode:
from pqcrypto import HashAlgorithm
sig = sign(sk, b"message", hash_algorithm=HashAlgorithm.Sha256)
verify(pk, b"message", sig, hash_algorithm=HashAlgorithm.Sha256)

pk_obj = PublicKey(pk)
sk_obj = SecretKey(sk)
sig_obj = sk_obj.sign(b"message")
pk_obj.verify(b"message", sig_obj)

Size constants

from pqcrypto.kem.ml_kem_512 import PUBLIC_KEY_SIZE, SECRET_KEY_SIZE, CIPHERTEXT_SIZE, SHARED_SECRET_SIZE
from pqcrypto.sign.ml_dsa_44 import PUBLIC_KEY_SIZE, SECRET_KEY_SIZE, SIGNATURE_SIZE

Algorithms

Modules live in pqcrypto.kem (KEM) and pqcrypto.sign (signatures).

Key Encapsulation

  • ML-KEM (FIPS 203)
    • ml_kem_512, ml_kem_768, ml_kem_1024
  • Classic McEliece
    • mceliece_348864
    • mceliece_348864f
    • mceliece_460896
    • mceliece_460896f
    • mceliece_6688128
    • mceliece_6688128f
    • mceliece_6960119
    • mceliece_6960119f
    • mceliece_8192128
    • mceliece_8192128f
  • SNTRUP
    • sntrup_653
    • sntrup_761
    • sntrup_857
    • sntrup_953
    • sntrup_1013
    • sntrup_1277
  • HQC (FIPS 207)
    • hqc_128, hqc_192, hqc_256

Signatures

  • ML-DSA (FIPS 204)
    • ml_dsa_44, ml_dsa_65, ml_dsa_87
  • SLH-DSA (FIPS 205)
    • slh_dsa_sha2_128s
    • slh_dsa_sha2_128f
    • slh_dsa_sha2_192s
    • slh_dsa_sha2_192f
    • slh_dsa_sha2_256s
    • slh_dsa_sha2_256f
    • slh_dsa_shake_128s
    • slh_dsa_shake_128f
    • slh_dsa_shake_192s
    • slh_dsa_shake_192f
    • slh_dsa_shake_256s
    • slh_dsa_shake_256f

Security

The cryptographic implementations are provided by the backbone crates. These crates have not undergone a formal security audit; third-party review is recommended before production use. This Python wrapper is a thin shim — it validates key lengths, maps errors to Python exceptions, and provides idiomatic key objects.

License

Apache-2.0. See LICENSE.

Metadata

Release files for pqcrypto 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pqcrypto 1.0.0
File Size Uploaded
pqcrypto-1.0.0.tar.gz 19.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pqcrypto 1.0.0
File
pqcrypto-1.0.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl CPython 3.9 abi3 Linux glibc 2.34+ x86-64 Details
pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl CPython 3.9 abi3 Linux glibc 2.34+ ARM64 Details
pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 6.2 MB

Release files / pqcrypto-1.0.0.tar.gz

Download URL pqcrypto-1.0.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b41e6cba972e010d5f3674d8a52bc75d8742e1e5d063b57ba172127cf3ef9c40
BLAKE2b-256 checksum
How to use checksums
5b10e835821a6c5df73b196b27812bd5f1562df8f675acab6ad5232b8c28916d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-win_amd64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-win_amd64.whl
Size 756.9 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d65d0fdbd2bfcfd80193d1d499142e63dd8ea6a072e1dc68b1b36fd49f9fdc8f
BLAKE2b-256 checksum
How to use checksums
9bfef6fb3cdf26345882c408d0d9302e0a2be8084ba1cb67710318b3be0ebf76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
9160e59a8b9a860ea960a0b2fb8b479ee2d56f3c062c4be3f86ce346807443dd
BLAKE2b-256 checksum
How to use checksums
b82248c29acd771fa55b26e20b66df194a6a63166cf4b5cffba7c4d59ffc66b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 1.0 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
f8c29900937b84ce18943694acb7276af36e2c52e1673debe02ecf9494472a35
BLAKE2b-256 checksum
How to use checksums
8dc8fd11c1e4ebbc019274843f170e23907553fd8b9a30c9c33b2cc02fcf3a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl
Size 857.9 kB
Tags CPython 3.9 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
7068532dbc1225a9d668d59940bd96dc13f40175a757b2e31c69aa697781f4d0
BLAKE2b-256 checksum
How to use checksums
c6c2965a137eef8d95f9cf25c3dbe935540cff303c272ee045dc9f110bd206d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl
Size 871.3 kB
Tags CPython 3.9 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
71b199d6460a646071cdb505e6acca8c9a050c3252bba023b8065b9518dce9c9
BLAKE2b-256 checksum
How to use checksums
e9920876f27be9289cdf87bcef5dbcbc42d89eacfd6ecb99f23928ef3a21a700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Size 831.1 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ccc13a4443a499d70aa9d29ce899e8782d4a5e57b79baa92fa13ea33512533c7
BLAKE2b-256 checksum
How to use checksums
50f2790da887e9167e4bc3d41e470c7ad1cd90df90c66e2da8b3d11f284c37f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 797.6 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3c0aa8346222631418e7caac040a53cc1f5245553d3275ce1d8403cfe8dd9fb4
BLAKE2b-256 checksum
How to use checksums
d561bdddb98d0d19c8177c4bcb4e9a75762ee81b7518eef9f69f0b5018873101
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

8 release files

0.4.0

49 release files

0.3.1

50 release files

0.3.0

20 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page