Skip to main content

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)

Metadata

Release files for pyky 1.0.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 pyky 1.0.2
File Size Uploaded
pyky-1.0.2.tar.gz 406.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyky 1.0.2
File Interpreter ABI Platform
pyky-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 828.6 kB

Release files / pyky-1.0.2.tar.gz

Download URL pyky-1.0.2.tar.gz
Size 406.3 kB
Tags Source
SHA-256 checksum
How to use checksums
451f967faa7f01031a111058b2779ed46b19ec287a26a6c7cc4fd358a85f3a79
BLAKE2b-256 checksum
How to use checksums
b26721c1907543af3687d9d926e5701d75f62b2587995b35851084256b0ffc13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pyky-1.0.2-py3-none-any.whl

Download URL pyky-1.0.2-py3-none-any.whl
Size 422.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68cc5676847aa210e4892bf24ea8c2a611501a718f890cb52a98088b07509224
BLAKE2b-256 checksum
How to use checksums
85895061b9daf1800019a7df4c5024f0a1d761d2a59c7707ab98cdfe463c8af0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.0

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