Python bindings for the "PQClean" post-quantum cryptography library.
Project description
Usage
Simply install from PyPI with pip install pypqc, or see “Development” below if you want to tinker on the codebase!
KEMs
McEliece, Kyber, and HQC are currently provided, all with the same interface.:
# Available: hqc_128, hqc_192, hqc_256, # kyber512, kyber768, kyber1024, # mceliece348864, mceliece460896, # mceliece6688128, mceliece6960119, mceliece8192128 from pqc.kem import mceliece6960119 as kemalg # 1. Keypair generation pk, sk = kemalg.keypair() # 2. Key encapsulation ss, kem_ct = kemalg.encap(pk) # 3. Key de-encapsulation ss_result = kemalg.decap(kem_ct, sk) assert ss_result == ss
Capabilities not included in PQClean, such as McEliece signatures, Hybrid Encryption or KEM-TRANS, and message encapsulation, are not going to be implemented in this library. (Exception: Plaintext Confirmation is on the agenda for inclusion even if upstream ultimately decides to exclude it.)
Signature Algorithms
SPHINCS+, Dilithium, and Falcon are provided, all with the same interface.:
# Supported: dilithium2, dilithium3, dilithium5, # falcon_512, falcon_padded_512, falcon_1024, falcon_padded_1024, # sphincs_sha2_128f_simple, sphincs_sha2_128s_simple, # sphincs_shake_128f_simple, sphincs_shake_128s_simple, # sphincs_sha2_192f_simple, sphincs_sha2_192s_simple, # sphincs_shake_192f_simple, sphincs_shake_192s_simple, # sphincs_sha2_256f_simple, sphincs_sha2_256s_simple, # sphincs_shake_256f_simple, sphincs_shake_256s_simple from pqc.sign import sphincs_shake_256s_simple as sigalg # 1. Keypair generation pk, sk = sigalg.keypair() # 2. Signing # (detached signature) sig = sigalg.sign(MY_MESSAGE, sk) # 3. Signature verification # (Returns None on success; raises ValueError on failure.) sigalg.verify(sig, MY_MESSAGE, pk)
Regarding SPHINCS+: the Simple version is included; the Robust version is is not; SHA256 and SHAKE256 are included; Haraka is not. See https://github.com/PQClean/PQClean/discussions/548#discussioncomment-8565116 for more information.
Regarding Falcon: the Compressed and Padded versions are included, and are able to verify() each others’ signatures. The CT version is not currently planned.
Development
Dependencies:
Python 3 (tested mainly on CPython 3.9, 3.10, 3.11, and 3.12; and on PyPy 7.3.12)
-
Transitive non-PyPI build-time dependency: Python Headers (only Linux users need to manually install these; they come OOtB on Windows. Not sure about Mac.)
setuptools (build-time dependency)
wheel (build-time dependency)
a C compiler (build-time dependency)
If you’re on Windows, https://visualstudio.microsoft.com/visual-cpp-build-tools/
If setuptools is having trouble finding your compiler, make sure to first enter the appropriate environment. (For AMD64, this will be “x64 Native Tools Command Prompt for VS 2022”; for 32-bit x86, this will be “Developer Command Prompt for VS 2022”; for other situations, see the documentation.)
If you’re on Mac, reportedly Homebrew is a good choice.
It looks like you will also need pkgconfig and libffi, ideally installed via Homebrew, to build this.
If you’re on Linux, install build-essential or ‘Development Tools’ or something like that.
(I haven’t tested it, but if you’re allergic to installing things outside the venv you might be able to use this C compiler…)
Getting started:
Maybe use a venv or whatever if you want to
for Windows: py -m venv .venv & .venv\Scripts\activate.bat
for Linux and Mac: python3 -m venv .venv; . .venv/bin/activate (first install it, if needed)
Run python -m pip install .
Alternatively: you may get cleaner building with python -m build . (only after python -m pip install build)
Editable / “develop” mode not supported currently (CFFI will have to support this before it’s even on the table.)
If you get error 1104 when trying to compile, make a folder C:\temp, then try set "TMPDIR=C:\temp" and try again. (https://discuss.python.org/t/-/44077/5)
Run python -m pqc.demo to test it. If it prints “OK” and exits, the functions are almost certainly not broken. (Ideally, run this from a DIFFERENT directory, such as your home folder, so you can be sure it’s being imported properly and not being masked by the local copy.)
N.B. / FIXME: this function is currently NOT a full test suite; it only does a single encap-decap cycle with the default implementation of mceliece6960119. It does NOT test any other version of McEliece, or any signature algorithm.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file pypqc-0.0.7.0a3.tar.gz
.
File metadata
- Download URL: pypqc-0.0.7.0a3.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c7e13560459b11d54dfa74725ca4181c15e57925820f46efac9294dd13c072e |
|
MD5 | b467d688024918f94a05a31a331bee7e |
|
BLAKE2b-256 | 0b312c52f54ec3c0a9c351795e5a583df903cbd84572403019a18efb6d57b592 |
File details
Details for the file pypqc-0.0.7.0a3-pp310-pypy310_pp73-win_amd64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp310-pypy310_pp73-win_amd64.whl
- Upload date:
- Size: 730.6 kB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a4b42fe6fdf0f1f89526b64c6f26b964dd6fc01cc74ee1fe7a2d01f8681a75 |
|
MD5 | 44d3ed5b98412914154cef14f3ca2979 |
|
BLAKE2b-256 | 14f6880a368d1087014b6b65a62316027c302bf89d6c577e0180a809fd98bb38 |
File details
Details for the file pypqc-0.0.7.0a3-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 941.8 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87d04b00bdcfbc1801f2466cd7813064b910898f9156cf94f97a4c0a7197be1a |
|
MD5 | d0baefd5e7bbf95b1bb61472f4740cd4 |
|
BLAKE2b-256 | 7379028cd537315019eca2f10db8639735ed659a315363924c77065a91dc930e |
File details
Details for the file pypqc-0.0.7.0a3-pp39-pypy39_pp73-win_amd64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp39-pypy39_pp73-win_amd64.whl
- Upload date:
- Size: 730.5 kB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d36e7121c600f7a1be1607a46ed7e77bc43843a8228ff09a61231f5b48fb037 |
|
MD5 | efde7b6e4933eb48a4433d152c4482f6 |
|
BLAKE2b-256 | 1b9e42417476fbbc86019c986af915e1a505ce6d11959f1fec6c500a2b2524ef |
File details
Details for the file pypqc-0.0.7.0a3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 941.7 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fa2fcf900001727045196ffca49e9b1adc682272c12081ebec37670b61aea9d |
|
MD5 | 4bf97c6b91e28ac079de6908527904b7 |
|
BLAKE2b-256 | 5745b3411b8c8bef53bcb6896b708694bbaf324c602dc1ec7552066b46608993 |
File details
Details for the file pypqc-0.0.7.0a3-pp38-pypy38_pp73-win_amd64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp38-pypy38_pp73-win_amd64.whl
- Upload date:
- Size: 730.5 kB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b74d4d93172f67ca22363291d7216b5a8f10661bcd1558d452ebf7f152e3b845 |
|
MD5 | f2765fb712c9279759f87e6a20217b5d |
|
BLAKE2b-256 | ab5c9694b079e60aaf5c07af8f436cbc88bc88e31dd5a2cec590db1fe58798f4 |
File details
Details for the file pypqc-0.0.7.0a3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 941.8 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320817a7be281dd8a1f98c1595302c36cb8ca9fe58b99683c526895f20aaaf41 |
|
MD5 | ec17dcc1f6f0bea88d6cefd53ec26d02 |
|
BLAKE2b-256 | e5b3436d6fae48164dd81fad3aeb1479cfe8d4cbf875694a86ed11a745808551 |
File details
Details for the file pypqc-0.0.7.0a3-pp37-pypy37_pp73-win_amd64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp37-pypy37_pp73-win_amd64.whl
- Upload date:
- Size: 730.5 kB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a8a55235232c25a4d270b30c50cff1954a35abc2f3c055bc5dd604a36ffe7ca |
|
MD5 | b95cbe484bddef587f050436c3f055d8 |
|
BLAKE2b-256 | e1e352ca52aa231c49df7c0dd1458137b0dc0570c838db9c9132289b0790845d |
File details
Details for the file pypqc-0.0.7.0a3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 941.7 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c145be6b3a3ed52d6c2e3468eb5c35e66750a07fdecf5e71629008092ee828f |
|
MD5 | 602ccc5b10e1450b48d6373eb37f80eb |
|
BLAKE2b-256 | e6ad62fb582e123560b657340efc39b13d4f99b680baeeadd4571c601aecd98a |
File details
Details for the file pypqc-0.0.7.0a3-cp38-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3f64c56fdaea6b825aa3919cb3dbdb6aad3f56deb050f838e9337a382b79bac |
|
MD5 | 4851264cb75d68b4a70b4b3f8ac114d7 |
|
BLAKE2b-256 | aa3410194dc3a0c343b93a05dcfe29fa93fd62531c9f4f04bbe73bdfd502fbbf |
File details
Details for the file pypqc-0.0.7.0a3-cp38-abi3-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp38-abi3-macosx_10_9_universal2.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.8+, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae1140a9375e4fa47ebbf6acab1546610d4669beb26dc74b2864b7e420fea202 |
|
MD5 | 30eab8a6dcd8e49c766470d37fcf9736 |
|
BLAKE2b-256 | 299d314d6df9b29828a22aa47858d5189ccb98aa2dd1999193e663fdc8810f84 |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-win_amd64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 785.7 kB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a232226b96e8ab7cefa5b8124380d6921bce8d9c9487d3f8701d12c0db4b08 |
|
MD5 | c1038f70e03536176eaede13b54bf477 |
|
BLAKE2b-256 | 840a14563a2ca26353881fa1137e9a27c4fad4345fcd3098c3192fbe4d495f1e |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-win32.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-win32.whl
- Upload date:
- Size: 762.4 kB
- Tags: CPython 3.7+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 663ef3d8e9a67dcc65a52f6ff7b912c7f7188030c60317d40d85dd248381d5da |
|
MD5 | 24fdc430771c94d7102f1ea0427d40fb |
|
BLAKE2b-256 | 1b9544eba01d9147a06c3820221958f7f6d8cfa9355aa4d2ba5299ebcf84b36e |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e9529fff20f8c4b8c133ae8e773ef350ac316b61af9c5381f7dc0504a77da02 |
|
MD5 | c8d85eb44630e5adfa3623d5b90f97ad |
|
BLAKE2b-256 | 7391183c79040dda7c4a339bff7977fe6b16da14c37b528a67bb39a3f0c8f9a0 |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88862e2e63229d49b7a4c7ad0b2455ae67f6414b49d7dbbafa3d898c17276d68 |
|
MD5 | 7f59c5f8310cc7a7d88031a6b95cb29d |
|
BLAKE2b-256 | 5a562d766576a8bcd82463c60f4bf73ced1913739951cfe0af8bf98c8a624404 |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a57ac2498c8a25e4f19d9bb511a572a8185fdbdd1d5ece95eb80e9791a4ddd75 |
|
MD5 | 569a33ec89701f4dadcd801138ed843d |
|
BLAKE2b-256 | f13e57e5a405cf7697bcefb0e87452f3807c1af0248a3926c6cd420c041fedd0 |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476c5f97e35c99676867139bd2bd978eb8b01d004d5346b365d7b3a0e9c7735b |
|
MD5 | 6f2a68650f40746492f0c1f5750a09e2 |
|
BLAKE2b-256 | 291cc801a1347c069db216c9d9b0908f3c75ad906d1794558b3f2854e48efba4 |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ i686, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7abd5b0adff7acd1c4578468243f4b644d5a2234e0db888ec489463fd7089bd5 |
|
MD5 | c1ca145b8b7b6eaab530e5b0704401a3 |
|
BLAKE2b-256 | 8e101aae1940a4c80537f5c44ec0b4d2f58432693b32635e9c8e1be67b38d80a |
File details
Details for the file pypqc-0.0.7.0a3-cp37-abi3-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pypqc-0.0.7.0a3-cp37-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 573302816833d2db1f29dd03f1cfaad7c2b477361f041ee6f61223625469e183 |
|
MD5 | 26a411013dcfb67c4d81f64594faa3a9 |
|
BLAKE2b-256 | 2ee8490b2153f1f1ab287fb4738c919a8cd291389a635c9a2067f20a62befd3a |