Skip to content

Latest commit

 

History

99 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyber – ML-KEM

A pure Python implementation of ML-KEM (FIPS 203), built to understand the underlying mathematics and cryptography.

Validated against ACVP and C2SP test vectors for all three parameter sets (ML-KEM-512, ML-KEM-768, ML-KEM-1024).

Caution

This project is for educational purposes only. It is not hardened, not audited, and must not be used in real cryptographic applications.

Installation

git clone https://github.com/valentinfrm/pyber.git
cd pyber
uv sync

Using pyber

Exposed functions in kem.py:

  • keygen(): generate a keypair (ek, dk)
  • keygen_checked(): generate a keypair (ek, dk) with fault attack resistance
  • encaps(ek): generate a key and ciphertext pair (key, c)
  • decaps(dk, c): generate the symmetric key

Example

from pyber.kem import keygen, keygen_checked, encaps, decaps

# Key generation (use keygen_checked() for fault attack resistance)
public_key, private_key = keygen()

# Encapsulation
symmetric_key, ciphertext = encaps(public_key)

# Decapsulation
symmetric_key_dec = decaps(private_key, ciphertext)

assert symmetric_key == symmetric_key_dec

Performance

Fastest observed runtime over 20 runs on APPLE m1:

benchmark

References

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages