Skip to main content

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.:

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.:

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. These decisions are all inherited from PQClean; I don’t know much about their rationale.

Regarding Falcon: the Compressed version is included. The Padded version is not included, but TODO as soon as upstream adds it; the CT version is probably not going to be included.

Development

Dependencies:

  • Python 3 (tested mainly on CPython 3.9, 3.10, 3.11, and 3.12; and on PyPy 7.3.12)

  • cffi

    • 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)

Getting started:

  1. 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)

  2. 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.)

  3. 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.

Release files for pypqc 0.0.6.2

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

Source distribution (sdist)

Source distribution for pypqc 0.0.6.2
File Size Uploaded
pypqc-0.0.6.2.tar.gz 785.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pypqc 0.0.6.2
File
pypqc-0.0.6.2-pp310-pypy310_pp73-win_amd64.whl PyPy 3.10 PyPy 3.10 7.3 Windows x86-64 Details
pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.10 PyPy 3.10 7.3 Linux glibc 2.17+ x86-64 Details
pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl PyPy 3.10 PyPy 3.10 7.3 Linux glibc 2.5+ x86-32, Linux glibc 2.17+ x86-32 Details
pypqc-0.0.6.2-pp310-pypy310_pp73-macosx_10_9_x86_64.whl PyPy 3.10 PyPy 3.10 7.3 macOS 10.9+ x86-64 Details
pypqc-0.0.6.2-cp38-abi3-macosx_10_9_universal2.whl CPython 3.8 abi3 macOS 10.9+ universal2 (ARM64, x86-64) Details
pypqc-0.0.6.2-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details
pypqc-0.0.6.2-cp37-abi3-win32.whl CPython 3.7 abi3 Windows x86-32 Details
pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 abi3 Linux glibc 2.17+ x86-64 Details
pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.7 abi3 Linux glibc 2.17+ IBM System/390x Details
pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.7 abi3 Linux glibc 2.17+ PowerPC 64-le Details
pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.7 abi3 Linux glibc 2.17+ ARM64 Details
pypqc-0.0.6.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.7 abi3 Linux glibc 2.5+ x86-32, Linux glibc 2.17+ x86-32 Details

Total release size: 21.8 MB

Release files / pypqc-0.0.6.2.tar.gz

Download URL pypqc-0.0.6.2.tar.gz
Size 785.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f8f09a46971c2ef0cb5be4e5f5a280b3cdcdb01b3ef983091486eb40089228a5
BLAKE2b-256 checksum
How to use checksums
2edbd96a6edc03edce05d025d4d1542dd5d1ac1e414a51e12dc318fab4ca1e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-pp310-pypy310_pp73-win_amd64.whl

Download URL pypqc-0.0.6.2-pp310-pypy310_pp73-win_amd64.whl
Size 623.3 kB
Tags PyPy 3.10 PyPy 3.10 7.3 Windows x86-64
SHA-256 checksum
How to use checksums
2d2fea473964e7ff83a25f49eec43186cb7d3e663a1731324662d901ad878fa4
BLAKE2b-256 checksum
How to use checksums
962686330cbbfc1b20cdac479321078615366911027c0dc588ff3132e7a97bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 937.3 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.10 PyPy 3.10 7.3
SHA-256 checksum
How to use checksums
618d44efd03288349cc285fbe81760b13d2024325dc285cac80fdbe0e94cd5bd
BLAKE2b-256 checksum
How to use checksums
502086180c35c50aba01c7f5c11465bcfcab918597bc3e3806e84e3b7e40a9c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL pypqc-0.0.6.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 1.1 MB
Tags Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32 PyPy 3.10 PyPy 3.10 7.3
SHA-256 checksum
How to use checksums
f7b813de74e8f767fd6d00810b466bc76dc9fdae1c82837a829c9838163d2f67
BLAKE2b-256 checksum
How to use checksums
5047e018cd3952b853270e07ade06150834eebcbb583cac1732aacf2a4b6b9b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-pp310-pypy310_pp73-macosx_10_9_x86_64.whl

Download URL pypqc-0.0.6.2-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
Size 801.5 kB
Tags PyPy 3.10 PyPy 3.10 7.3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
2660701cc5a333296706156107b1591e69b08513a0d4f701d6ed16d8a6e5e9cb
BLAKE2b-256 checksum
How to use checksums
0df79c4a262cdf1fe5d5ecbb24924024957181853eda408646b7aa8f2552816e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp38-abi3-macosx_10_9_universal2.whl

Download URL pypqc-0.0.6.2-cp38-abi3-macosx_10_9_universal2.whl
Size 1.8 MB
Tags CPython 3.8 abi3 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
57d452353072efcbf92a117f6da3e2d9588d6d7ec93d8f5e3ff0e0a54e14ab56
BLAKE2b-256 checksum
How to use checksums
81bcc0cd6b5ac4240b1606d63441ff4076d77bb82418f40625e7b6135db13671
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-win_amd64.whl

Download URL pypqc-0.0.6.2-cp37-abi3-win_amd64.whl
Size 674.4 kB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c63aafc47921a43571fee62a76ab9e259b67054d31c0c812e9efbe26159ef8c7
BLAKE2b-256 checksum
How to use checksums
20ebdf33ef5717a5cc311189589037edd525dbfed7933046702465908f23bebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-win32.whl

Download URL pypqc-0.0.6.2-cp37-abi3-win32.whl
Size 652.6 kB
Tags CPython 3.7 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
e2070db26dc82f22067218d1465d4f6a9b964da9010865b832f3fe9b5b7da3cf
BLAKE2b-256 checksum
How to use checksums
bc39daed02fc17a2a5a33bca0a7859facfbbddf0179210598e635241c87c4338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.8 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bd106641e7ecc1eedd6e9213d34749374ba6b2ce65da6ede6784ad9315896091
BLAKE2b-256 checksum
How to use checksums
d3634a198aadf5eee43b6748c6ea4ab15b42cfb075fb61f914fa6b7dee6d82bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 3.2 MB
Tags CPython 3.7 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
efde01c55e9724aa7688c56444c2b36083bc8d2e1efdeb5f4b16d3e5ef0586e8
BLAKE2b-256 checksum
How to use checksums
3bcda79a62bd579dffe874eb60b40da83a7c143ca215440c98a0943bae1584d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 3.1 MB
Tags CPython 3.7 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
c828948344975e20f651ed640f022019f930c1248cd23195bf0abffb50d7a0f8
BLAKE2b-256 checksum
How to use checksums
444fad252ce82dc8f79eb18e9456d88aad1f0a16ed038f8f44ad6a24067e6add
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pypqc-0.0.6.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.6 MB
Tags CPython 3.7 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a2ae423317c12eeaf3853ee30a92041a5aff1c191f91756df460d7c03269cbb8
BLAKE2b-256 checksum
How to use checksums
a2288d3d22b672628723134f7f85ca1af745391b0ccfce9bd1910b9357d8b67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15

Release files / pypqc-0.0.6.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl

Download URL pypqc-0.0.6.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Size 2.7 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-32 Linux glibc 2.5+ x86-32 abi3
SHA-256 checksum
How to use checksums
2b0a6f5e7fc4110eccd90d8262f649b77e43ce41e7898ba61dfaafe94b76553b
BLAKE2b-256 checksum
How to use checksums
77247cf61c6674ee5af14b439ced2072199f3e4d54e715370af000f75c7b4b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.3.dev63+ga543352 PyPy/7.3.15
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