K064 / Advanced and next-generation cryptography
ML-KEM Kyber
ML-KEM is the FIPS 203 key encapsulation mechanism (KEM) standard for establishing a shared secret over a public channel.
CRYPTOGRAPHY LAB / K064
Cryptography Lab · ML-KEM Kyber
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
ML-KEM FIPS 203 NTT and inverse (256 coefficients; no key encapsulation)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- ML-KEM is the FIPS 203 key encapsulation mechanism (KEM) standard for establishing a shared secret over a public channel. Source document ↗
- Classification and reversibility
- KEM key establishment with KeyGen/Encaps/Decaps; decapsulation is deterministic, not ordinary encryption/encoding. Source document ↗
- Key or secret requirements
- Uses public encapsulation key and secret decapsulation key; anyone can generate shared secret and ciphertext with the public key. Source document ↗
- Operating principle and structure
- FO transform reencrypts candidate message and compares ciphertext, reducing invalid-ciphertext oracles. Source document ↗
- Key size, block size and parameters
- All parameter sets use n=256, q=3329; ML-KEM-512/768/1024 differ in ek/dk/ciphertext sizes; shared secret 32 bytes. Source document ↗
- Security strength and recommendation
- NIST recommends ML-KEM-768 as default parameter set. Source document ↗
- Known attacks and vulnerabilities
- No known mathematical break; reported failures involve implementation timing leaks, reportedly fixed in code. Source document ↗
- Standards and certification
- Approved and standardized in NIST FIPS 203 in 2024. Source document ↗
- Typical uses
- TLS and other protocol key exchange for session-key material; also VPN/IoT. Source document ↗
- Implementations, libraries and tools
- Intel Crypto Primitives Library supports FIPS 203 and 512/768/1024 sets. Source document ↗
- Decryption or decoding
- Typical APIs: keygen, encapsulate, decapsulate; latter returns shared secret. Source document ↗
- Advantages
- Considered resistant to quantum attacks; established secret can feed symmetric encryption. Source document ↗
- Limitations and cautions
- Educational implementations may be non-constant-time or side-channel vulnerable; use vetted implementations. Source document ↗
- Distinguishing encryption, encoding and hashing
- ML-KEM establishes shared secret, not general encryption/hash/encoding; use secret for symmetric encryption. Source document ↗
Practical examples
Example
Sender encapsulates with recipient public ek to obtain shared secret and ciphertext; sends ciphertext. Recipient decapsulates with secret dk and ciphertext to obtain same secret.
Procedure
KeyGen produces ek/dk; Encaps(ek) returns secret/ciphertext; send ciphertext; Decaps(dk,ciphertext) recovers secret. Connect secret to KDF/AEAD for actual encryption/decryption. Distinguish KEM from Base64, hashing and general decryption.
Scenario
Establish TLS 1.3 session keys with hybrids such as X25519MLKEM768; PQ establishment for VPN/IoT. Applications protect data via HKDF/AEAD after obtaining secret.
Pitfalls and alternatives
Older Kyber and ML-KEM encodings may not interoperate automatically. Avoid unaudited/non-constant-time implementations, side channels and key/secret reuse; use FIPS 203-vetted library, hybrid exchange and KDF/AEAD.
References
- Module-Lattice-Based Key-Encapsulation Mechanism Standard | FIPS 203 ↗
- Module-Lattice-Based Key-Encapsulation Mechanism Standard ↗
- Using ML-KEM with CNG for Key Exchange - Win32 apps | Microsoft Learn ↗
- 16 Complete Implementation of ML-KEM (FIPS 203) — Applied PQC ↗
- Inside ML-KEM | Quantum Defense ↗
- ML-KEM: viability, conditions and evidence | Has it been Pwned ↗
- Post-Quantum Cryptography FIPS Approved | CSRC ↗
- ML-KEM ↗
- cl-kyber: Pure Common Lisp implementation of **ML-KEM** (FIPS 203), the NIST post-quantum key encapsulation mechanism formerly known as CRYSTALS-Kyber. ↗
- README.md ↗