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_348864mceliece_348864fmceliece_460896mceliece_460896fmceliece_6688128mceliece_6688128fmceliece_6960119mceliece_6960119fmceliece_8192128mceliece_8192128f
- SNTRUP
sntrup_653sntrup_761sntrup_857sntrup_953sntrup_1013sntrup_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_128sslh_dsa_sha2_128fslh_dsa_sha2_192sslh_dsa_sha2_192fslh_dsa_sha2_256sslh_dsa_sha2_256fslh_dsa_shake_128sslh_dsa_shake_128fslh_dsa_shake_192sslh_dsa_shake_192fslh_dsa_shake_256sslh_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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pqcrypto-1.0.0.tar.gz.
File metadata
- Download URL: pqcrypto-1.0.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b41e6cba972e010d5f3674d8a52bc75d8742e1e5d063b57ba172127cf3ef9c40
|
|
| MD5 |
7894a4bd26f5d056a076047f98f0eb52
|
|
| BLAKE2b-256 |
5b10e835821a6c5df73b196b27812bd5f1562df8f675acab6ad5232b8c28916d
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0.tar.gz:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0.tar.gz -
Subject digest:
b41e6cba972e010d5f3674d8a52bc75d8742e1e5d063b57ba172127cf3ef9c40 - Sigstore transparency entry: 2474770909
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 756.9 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d65d0fdbd2bfcfd80193d1d499142e63dd8ea6a072e1dc68b1b36fd49f9fdc8f
|
|
| MD5 |
a7c6d6c1660684ada10e8d5044c08559
|
|
| BLAKE2b-256 |
9bfef6fb3cdf26345882c408d0d9302e0a2be8084ba1cb67710318b3be0ebf76
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-win_amd64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-win_amd64.whl -
Subject digest:
d65d0fdbd2bfcfd80193d1d499142e63dd8ea6a072e1dc68b1b36fd49f9fdc8f - Sigstore transparency entry: 2474771125
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9160e59a8b9a860ea960a0b2fb8b479ee2d56f3c062c4be3f86ce346807443dd
|
|
| MD5 |
15dbe6cdb5693b278f6491a0de635d05
|
|
| BLAKE2b-256 |
b82248c29acd771fa55b26e20b66df194a6a63166cf4b5cffba7c4d59ffc66b0
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
9160e59a8b9a860ea960a0b2fb8b479ee2d56f3c062c4be3f86ce346807443dd - Sigstore transparency entry: 2474771393
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8c29900937b84ce18943694acb7276af36e2c52e1673debe02ecf9494472a35
|
|
| MD5 |
9ced0ddc6325aca47eb522571d478073
|
|
| BLAKE2b-256 |
8dc8fd11c1e4ebbc019274843f170e23907553fd8b9a30c9c33b2cc02fcf3a60
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
f8c29900937b84ce18943694acb7276af36e2c52e1673debe02ecf9494472a35 - Sigstore transparency entry: 2474771851
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 857.9 kB
- Tags: CPython 3.9+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7068532dbc1225a9d668d59940bd96dc13f40175a757b2e31c69aa697781f4d0
|
|
| MD5 |
a6f274d6572352dc7078c172b52a07fa
|
|
| BLAKE2b-256 |
c6c2965a137eef8d95f9cf25c3dbe935540cff303c272ee045dc9f110bd206d8
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
7068532dbc1225a9d668d59940bd96dc13f40175a757b2e31c69aa697781f4d0 - Sigstore transparency entry: 2474772158
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 871.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71b199d6460a646071cdb505e6acca8c9a050c3252bba023b8065b9518dce9c9
|
|
| MD5 |
93b92053875d321364bf01d275563eaf
|
|
| BLAKE2b-256 |
e9920876f27be9289cdf87bcef5dbcbc42d89eacfd6ecb99f23928ef3a21a700
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-manylinux_2_34_aarch64.whl -
Subject digest:
71b199d6460a646071cdb505e6acca8c9a050c3252bba023b8065b9518dce9c9 - Sigstore transparency entry: 2474772842
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 831.1 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc13a4443a499d70aa9d29ce899e8782d4a5e57b79baa92fa13ea33512533c7
|
|
| MD5 |
fc7cce160e8e9860194a14afbb564085
|
|
| BLAKE2b-256 |
50f2790da887e9167e4bc3d41e470c7ad1cd90df90c66e2da8b3d11f284c37f0
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
ccc13a4443a499d70aa9d29ce899e8782d4a5e57b79baa92fa13ea33512533c7 - Sigstore transparency entry: 2474773244
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 797.6 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c0aa8346222631418e7caac040a53cc1f5245553d3275ce1d8403cfe8dd9fb4
|
|
| MD5 |
499f810a0ab086ddc8526442f4c01ab5
|
|
| BLAKE2b-256 |
d561bdddb98d0d19c8177c4bcb4e9a75762ee81b7518eef9f69f0b5018873101
|
Provenance
The following attestation bundles were made for pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
ci.yml on backbone-hq/pqcrypto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pqcrypto-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
3c0aa8346222631418e7caac040a53cc1f5245553d3275ce1d8403cfe8dd9fb4 - Sigstore transparency entry: 2474772595
- Sigstore integration time:
-
Permalink:
backbone-hq/pqcrypto@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/backbone-hq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@d47c464e6e803828e1e030474c5abfe09ec5c320 -
Trigger Event:
push
-
Statement type: