Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidbuchanan314/ml-kem-stuff
A toy implementation of ML-KEM, aka Kyber, based on the current FIPS 203 draft
https://github.com/davidbuchanan314/ml-kem-stuff
cryptography cryptography-algorithms key-encapsulation-mechanism kyber ml-kem post-quantum-cryptography pqc python
Last synced: 5 days ago
JSON representation
A toy implementation of ML-KEM, aka Kyber, based on the current FIPS 203 draft
- Host: GitHub
- URL: https://github.com/davidbuchanan314/ml-kem-stuff
- Owner: DavidBuchanan314
- License: mit
- Created: 2023-12-24T17:19:31.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-16T07:00:14.000Z (10 months ago)
- Last Synced: 2024-01-16T12:54:28.897Z (10 months ago)
- Topics: cryptography, cryptography-algorithms, key-encapsulation-mechanism, kyber, ml-kem, post-quantum-cryptography, pqc, python
- Language: Python
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ml-kem-stuff
A toy implementation of ML-KEM, aka Kyber, based on the current [FIPS 203 draft](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.ipd.pdf).
This implementation is INCOMPLETE and **INSECURE**, the latter being explicitly out of scope. The current status is "it looks like it works" - it's able to derive a shared secret, but I have no idea if it's doing it correctly. ~~I'll do some more rigorous testing later.~~ It passes [these test vectors](https://github.com/post-quantum-cryptography/KAT/tree/main/MLKEM) at least.
This implementation is *NOT* constant-time, currently.
I wrote this to get my head around ML-KEM, and it's honestly a lot simpler than I was expecting. I'd also read [this](https://words.filippo.io/dispatches/kyber-math/) beforehand, which helped a lot. I was particularly surprised by how simple the implementation of the NTT is, given how conceptually mind-bending it is (at least, it is for me).
You may also be interested in [GiacomoPope/kyber-py](https://github.com/GiacomoPope/kyber-py), which is basically a more polished version of this repo. However, I avoided looking at any other implementations before embarking on my own, because I wanted to challenge myself and make sure I wasn't skipping any details.
## TODO:
- Proper input validation.
- ~~Actually test it against some test vectors.~~ ML-KEM-768 KAT passed!
- ~~Find out if the minor spec bugs I encountered are real and/or already reported.~~ (answer: yes to both!)