Skip to main content

A Python implementation of Kyber Post-Quantum KEM

Project description

NOT MAINTAINED ANYMORE

I wrote this implementation three years ago to understand Kyber - when it was a hot candidate to be selected in the NIST process. Meanwhile, there are other, better maintained implementations out there.

If you are looking for a clean, straight-forward and well-tested implementation of Kyber (now standardized as ML-KEM) I recommend the Python implementation of Markku-Juhani O. Saarinen.

Crystals-Kyber in Python

About

  • just a toy implementation to better understand the algorithm
  • all three 512, 768 and 1024 sec levels.
  • ported from the reference and the Go Implementation, so not the fanciest Python code
  • not hardened against (timing/other) side channel attacks
  • test coverage is poor, use at your own risk

How To Use

Just take a look at ccakem.py. Functions

  • kem_keygenXXX(),
  • kem_encapsXXX(pubkey, seed=None) and
  • kem_decapsXXX(private_key, ciphertext)

correspond directly to the spec. For kem_encaps you can optionally provide a custom seed which is useful for debugging.

Typical kem, e.g. 512 sec level, would be

priv, pub = kem_keygen512()
secret1, cipher = kem_encaps512(pub)
secret2 = kem_decaps512(priv, cipher)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyky-1.0.2.tar.gz (406.3 kB view details)

Uploaded Source

Built Distribution

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

pyky-1.0.2-py3-none-any.whl (422.3 kB view details)

Uploaded Python 3

File details

Details for the file pyky-1.0.2.tar.gz.

File metadata

  • Download URL: pyky-1.0.2.tar.gz
  • Upload date:
  • Size: 406.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pyky-1.0.2.tar.gz
Algorithm Hash digest
SHA256 451f967faa7f01031a111058b2779ed46b19ec287a26a6c7cc4fd358a85f3a79
MD5 f2ee27a7dc53b90813c0283875d28d02
BLAKE2b-256 b26721c1907543af3687d9d926e5701d75f62b2587995b35851084256b0ffc13

See more details on using hashes here.

File details

Details for the file pyky-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyky-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 422.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pyky-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 68cc5676847aa210e4892bf24ea8c2a611501a718f890cb52a98088b07509224
MD5 2e74244f8ec0b553b3663a3bb5ab2d8c
BLAKE2b-256 85895061b9daf1800019a7df4c5024f0a1d761d2a59c7707ab98cdfe463c8af0

See more details on using hashes here.

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