Skip to main content

QuantCrypt

Logo

PyPI - Python Version GitHub License codecov GitHub Actions Workflow Status PyPI - Downloads

Quality Gate Status Security Rating Reliability Rating Maintainability Rating
Vulnerabilities Bugs Code Smells Lines of Code

Description

QuantCrypt is a cross-platform Python library for Post-Quantum Cryptography using precompiled PQClean binaries. While QuantCrypt contains multiple variants of PQC algorithms that are standardized by NIST, it is recommended to use only the strongest variants as recommended by the CNSA advisory by NSA.

Motivation

Currently, there does not exist any pure-Python implementation of Post-Quantum Cryptographic algorithms, which requires Python developers to first discover where to get reliable C source code of PQC algorithms, then install the necessary C compilers on their system and then figure out how to use CFFI to compile and use the C code in their Python source code. Furthermore, those binaries would be only compatible with the platform that they were compiled on, making it very difficult to use separate platforms for development and deployment workflows, without having to recompile the C source code each time.

This library solves this problem by pre-compiling the C source code of PQC algorithms for Windows, Linux and Darwin platforms in GitHub Actions using CFFI, and it also provides a nice Python wrapper around the PQC binaries. Since I wanted this library to be all-encompassing, it also contains a lot of helper classes which one might need when working with Post-Quantum cryptography. This library places a lot of focus on Developer Experience, aiming to be powerful in features, yet easy and enjoyable to use, so it would just work for your project.

Quickstart

The full documentation of this library can be found in the Wiki. Because this library is rich in docstrings which provide detailed insight into the library's behavior, it is suggested to use an IDE which supports autocomplete and code insights when working with this library. Most popular choices are either PyCharm or VS Code with Python-specific plugins.

Install

To install QuantCrypt with its default dependencies (no compiler), use one of the following commands:

Using UV (recommended):

uv add quantcrypt

Using Poetry:

poetry add quantcrypt

Using pip:

pip install quantcrypt

If you want to recompile PQA binaries on your own machine, you can install QuantCrypt with optional dependencies by appending [compiler] to one of the install commands outlined above.

QuantCrypt publishes prebuilt wheels with precompiled binaries to the PyPI registry. If your platform supports one of the prebuilt wheels, then you don't need to install QuantCrypt with the compiler option to be able to use the library.

Note: If you do decide to recompile PQA binaries, you will need to install platform-specific C/C++ build tools like Visual Studio, Xcode or GNU Make (non-exhaustive list).

Note: If you attempt to import the compiler module programmatically when optional dependencies are missing, you will receive an import error.

Script Imports

from quantcrypt import (
    kem,      # Key Encapsulation Mechanism algos   - public-key cryptography
    dss,      # Digital Signature Scheme algos      - secret-key signatures
    cipher,   # The Krypton Cipher                  - symmetric cipher based on AES-256
    kdf,      # Argon2 helpers + KMAC-KDF           - key derivation functions
    errors,   # All errors QuantCrypt may raise     - also available from other modules
    utils,    # Helper utilities from all modules   - gathered into one module
    compiler  # Tools for compiling PQA binaries    - requires optional dependencies
)

CLI Commands

The general functionality of this library is also available from the command-line, which you can access with the qclib command. Keep in mind that if you install QuantCrypt into a venv, you will need to activate the venv to access the CLI. QuantCrypt uses Typer internally to provide the CLI experience. You can use the --help option to learn more about each command and subcommand.

qclib --help
qclib --version

qclib info --help
qclib keygen --help
qclib encrypt --help
qclib decrypt --help
qclib sign --help
qclib verify --help
qclib remove --help
qclib compile --help

Note: The compile CLI command becomes available when QuantCrypt has been installed with optional dependencies for the compiler.

Security Statement

The PQC algorithms used in this library inherit their security from the PQClean project. You can read the security statement of the PQClean project from their SECURITY.md file. To report a security vulnerability for a PQC algorithm, please create an issue in the PQClean repository.

Credits

This library would be impossible without these essential dependencies:

  • PQClean - C source code of Post-Quantum Cryptography algorithms
  • Cryptodome - AES-256 and SHA3 implementation
  • Argon2-CFFI - Argon2 KDF implementation

I thank the creators and maintainers of these libraries for their hard work.

Metadata

Release files for quantcrypt 1.0.1

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

Source distribution (sdist)

Source distribution for quantcrypt 1.0.1
File Size Uploaded
quantcrypt-1.0.1.tar.gz 36.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for quantcrypt 1.0.1
File
quantcrypt-1.0.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details
quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
quantcrypt-1.0.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details
quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
quantcrypt-1.0.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.39+ x86-64 Details
quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
quantcrypt-1.0.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.39+ x86-64 Details
quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 47.0 MB

Release files / quantcrypt-1.0.1.tar.gz

Download URL quantcrypt-1.0.1.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
781e6368e5f4e4a006dd4c791bb4f7bc32219fe753c81135b701a3054f260d46
BLAKE2b-256 checksum
How to use checksums
ae6e3be236a830366e9eb8993850395892791ed9c4fabbe02edbda28f8dcc4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp313-cp313-win_amd64.whl

Download URL quantcrypt-1.0.1-cp313-cp313-win_amd64.whl
Size 505.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
fd5d51f686b23e2acae956e721463eb148c0acad53fa8eb8221337014c594588
BLAKE2b-256 checksum
How to use checksums
a01defe96e8ad8bb6de84ef9c09eaad200f8e9d1ca11e183edd06dc7f7c18e07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl
Size 10.3 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
220e89f9073c6671395d00ecca53ab790ef9fa574a3e2a7e9d19a1d632acad1e
BLAKE2b-256 checksum
How to use checksums
89edabd1dfbb2a07bad20cc7d873e9bfe4dd140c67adc2363d084150c10f7779
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl

Download URL quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl
Size 784.5 kB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
d58813bd7989e62841912de898d41f61d06be0e8bab90287768c5d393bd51def
BLAKE2b-256 checksum
How to use checksums
54baf11efd75e49c97ed27af14f1d0f908c14296cbc70775516820de4432db5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp312-cp312-win_amd64.whl

Download URL quantcrypt-1.0.1-cp312-cp312-win_amd64.whl
Size 505.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
607eec4b9c0eed3e0a24dc56ac73379f84cc839dbfc641afcbfd85f6adac6de8
BLAKE2b-256 checksum
How to use checksums
f1f922d1f8ddb6ed7ba2e28de690a41dc48ff6c63c1f799a677e23b94b691024
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 10.2 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
549d4b25e2bdfaaa88fe4b7083b65315aecb5b4da811a39ac7c9910bdfc1ede9
BLAKE2b-256 checksum
How to use checksums
66820e1f91f483384a8c9b158a26ccf14fa428a15517e7812d48bd818c88f254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl

Download URL quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl
Size 784.5 kB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
6327b9a02d322df3da6daf578e3c7e97a8c84f2485dc627fdd403b31d75abe01
BLAKE2b-256 checksum
How to use checksums
7f80399f65ec736c046e13e2bee77d7ac4ce0c7131746cacdf6661697ca70b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp311-cp311-win_amd64.whl

Download URL quantcrypt-1.0.1-cp311-cp311-win_amd64.whl
Size 505.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
fd2619adee7994411bf94f79f5b6d9065a631b5be50251d2b61c64b10d6701e4
BLAKE2b-256 checksum
How to use checksums
55dc59f789526437434bc32efb0ecf58141d282ccc41f023791b6c80f38b4ea6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl

Download URL quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl
Size 10.3 MB
Tags CPython 3.11 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
35cb37fe871c535c78aa2fe97f75cfa731ca345a272ac1bbf242b98033111f81
BLAKE2b-256 checksum
How to use checksums
eee460220a46ac32e3075cea2f79fe4f95f706546e1c49c70c7e3e46941ae58e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl

Download URL quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl
Size 1.5 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
12869b28e1a1f79e78f80daf742b35ec73f74c6d8afae947ac426cd1b2ef75f9
BLAKE2b-256 checksum
How to use checksums
563aa3e2b05987e785d62eb4b81bb0d76b73a79f99f5e8f26f3f0a3bea309abf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp310-cp310-win_amd64.whl

Download URL quantcrypt-1.0.1-cp310-cp310-win_amd64.whl
Size 505.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
ecdeadb9e4bff5ce9dd0be287309a2ada776010b127315f5b4ce745e7f91ece6
BLAKE2b-256 checksum
How to use checksums
0eaaa71948792d5a9db6098dbc6521ee8d855ede12a9ef49c412beefc2430105
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl

Download URL quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl
Size 10.3 MB
Tags CPython 3.10 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
ff4764f717be84b7d1be411d84efdfa7198274a0f7e1edc960ed8d0a2da503b9
BLAKE2b-256 checksum
How to use checksums
b3a3a58125b4bbe900d09cbc5bf5ec0f75d8ecf0cf0b0c9e4f8b2418447f23a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release files / quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl

Download URL quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl
Size 784.4 kB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
e9c1d89e13c9fb07866467525e202030ad59eccb13fa4053724dc414468933f1
BLAKE2b-256 checksum
How to use checksums
a355d239d2c0a7fb9e391bb71b0b3c480cd7827b8771b21a75d292de0f6589fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Mar 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

13 release files

1.0.0

13 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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