Skip to main content

Cross-platform Python library for Post-Quantum Cryptography using precompiled PQClean binaries

Project description

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.

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

quantcrypt-1.0.1.tar.gz (36.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

quantcrypt-1.0.1-cp313-cp313-win_amd64.whl (505.3 kB view details)

Uploaded CPython 3.13Windows x86-64

quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl (784.5 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

quantcrypt-1.0.1-cp312-cp312-win_amd64.whl (505.4 kB view details)

Uploaded CPython 3.12Windows x86-64

quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl (784.5 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

quantcrypt-1.0.1-cp311-cp311-win_amd64.whl (505.2 kB view details)

Uploaded CPython 3.11Windows x86-64

quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

quantcrypt-1.0.1-cp310-cp310-win_amd64.whl (505.2 kB view details)

Uploaded CPython 3.10Windows x86-64

quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl (10.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl (784.4 kB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file quantcrypt-1.0.1.tar.gz.

File metadata

  • Download URL: quantcrypt-1.0.1.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quantcrypt-1.0.1.tar.gz
Algorithm Hash digest
SHA256 781e6368e5f4e4a006dd4c791bb4f7bc32219fe753c81135b701a3054f260d46
MD5 b42884be0c707af171fc01839cea2abd
BLAKE2b-256 ae6e3be236a830366e9eb8993850395892791ed9c4fabbe02edbda28f8dcc4d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1.tar.gz:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: quantcrypt-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 505.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quantcrypt-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fd5d51f686b23e2acae956e721463eb148c0acad53fa8eb8221337014c594588
MD5 cb99728ea97d4f3f787e417d1c2cc4c0
BLAKE2b-256 a01defe96e8ad8bb6de84ef9c09eaad200f8e9d1ca11e183edd06dc7f7c18e07

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp313-cp313-win_amd64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 220e89f9073c6671395d00ecca53ab790ef9fa574a3e2a7e9d19a1d632acad1e
MD5 e5e8a97e384b2a70796bdfa1e7d0f64c
BLAKE2b-256 89edabd1dfbb2a07bad20cc7d873e9bfe4dd140c67adc2363d084150c10f7779

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d58813bd7989e62841912de898d41f61d06be0e8bab90287768c5d393bd51def
MD5 4866bbe6bb9485e490e40350cbf818f0
BLAKE2b-256 54baf11efd75e49c97ed27af14f1d0f908c14296cbc70775516820de4432db5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: quantcrypt-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 505.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quantcrypt-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 607eec4b9c0eed3e0a24dc56ac73379f84cc839dbfc641afcbfd85f6adac6de8
MD5 fdf780d22e0ce95473ca20c87fcb4dea
BLAKE2b-256 f1f922d1f8ddb6ed7ba2e28de690a41dc48ff6c63c1f799a677e23b94b691024

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp312-cp312-win_amd64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 549d4b25e2bdfaaa88fe4b7083b65315aecb5b4da811a39ac7c9910bdfc1ede9
MD5 cb21cd7e031fdc645cc234b47ed4c602
BLAKE2b-256 66820e1f91f483384a8c9b158a26ccf14fa428a15517e7812d48bd818c88f254

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 6327b9a02d322df3da6daf578e3c7e97a8c84f2485dc627fdd403b31d75abe01
MD5 b4b244ada0ad71fef12d2d8f8492294c
BLAKE2b-256 7f80399f65ec736c046e13e2bee77d7ac4ce0c7131746cacdf6661697ca70b7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: quantcrypt-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 505.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quantcrypt-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fd2619adee7994411bf94f79f5b6d9065a631b5be50251d2b61c64b10d6701e4
MD5 90ba2220bb5ce5892d223f78d1e90740
BLAKE2b-256 55dc59f789526437434bc32efb0ecf58141d282ccc41f023791b6c80f38b4ea6

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp311-cp311-win_amd64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 35cb37fe871c535c78aa2fe97f75cfa731ca345a272ac1bbf242b98033111f81
MD5 80eb424e7e96daaf07bbaf25f5d1b95b
BLAKE2b-256 eee460220a46ac32e3075cea2f79fe4f95f706546e1c49c70c7e3e46941ae58e

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 12869b28e1a1f79e78f80daf742b35ec73f74c6d8afae947ac426cd1b2ef75f9
MD5 498ed7ddf01730a2f2f631e2e07cf955
BLAKE2b-256 563aa3e2b05987e785d62eb4b81bb0d76b73a79f99f5e8f26f3f0a3bea309abf

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: quantcrypt-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 505.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quantcrypt-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ecdeadb9e4bff5ce9dd0be287309a2ada776010b127315f5b4ce745e7f91ece6
MD5 cc9ab34cd340a7a286ed73276e2d03a7
BLAKE2b-256 0eaaa71948792d5a9db6098dbc6521ee8d855ede12a9ef49c412beefc2430105

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp310-cp310-win_amd64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ff4764f717be84b7d1be411d84efdfa7198274a0f7e1edc960ed8d0a2da503b9
MD5 58174177316871b755a9b4c860e6ed9a
BLAKE2b-256 b3a3a58125b4bbe900d09cbc5bf5ec0f75d8ecf0cf0b0c9e4f8b2418447f23a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e9c1d89e13c9fb07866467525e202030ad59eccb13fa4053724dc414468933f1
MD5 f46f1b720cadeb664b1c5b853a33f33f
BLAKE2b-256 a355d239d2c0a7fb9e391bb71b0b3c480cd7827b8771b21a75d292de0f6589fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantcrypt-1.0.1-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: build-publish.yml on aabmets/quantcrypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page