ML-KEM-512
NIST's primary post-quantum key encapsulation mechanism, standardised in FIPS 203
About ML-KEM-512
ML-KEM-512 is one of 3 ML-KEM variants in the NextSSL registry, a key encapsulation mechanism. It uses an 800-byte public key, a 1,632-byte secret key, a 768-byte ciphertext, a 32-byte shared secret and a 64-byte seed. Its registry entry cites FIPS 203. It is also known as mlkem512. It is designed to resist attacks by large quantum computers. NextSSL lists it in the safe tier and exposes it through the safe API.
Overview
ML-KEM is the Module-Lattice-Based Key-Encapsulation Mechanism standardised by NIST in FIPS 203. It lets two parties establish a shared secret that is believed to resist attacks by both classical and quantum computers, and it is the default choice for post-quantum key establishment.
ML-KEM is derived from CRYSTALS-Kyber, the lattice-based KEM that NIST selected at the end of the third round of its post-quantum standardisation process. Its security rests on the Module Learning With Errors problem: recovering a secret vector from noisy linear equations over a polynomial ring. Arithmetic takes place in the ring of polynomials of degree below 256 with coefficients modulo 3329, which allows fast multiplication with the number-theoretic transform.
The scheme starts from an IND-CPA public-key encryption scheme and turns it into an IND-CCA2 secure KEM with a variant of the Fujisaki-Okamoto transform. Decapsulation re-encrypts the recovered message and compares the result with the received ciphertext; on mismatch it returns a pseudorandom value derived from a secret seed (implicit rejection), so invalid ciphertexts reveal nothing useful to an attacker.
Three parameter sets are defined. ML-KEM-512 targets NIST security category 1 (comparable to AES-128), ML-KEM-768 targets category 3 and ML-KEM-1024 targets category 5. ML-KEM-768 is the most widely deployed set and is the one used in the X25519MLKEM768 hybrid key exchange for TLS 1.3. Public keys range from 800 to 1568 bytes and ciphertexts from 768 to 1568 bytes. Secret keys are larger, up to 3168 bytes, because they embed the public key and its hash.
History
2016–2025NIST calls for post-quantum KEMs and signatures
NIST Post-Quantum Cryptography standardisationCRYSTALS-Kyber submitted to NIST PQC
26 candidates advance to round 2
NIST Post-Quantum Cryptography standardisationRound 3 finalists and alternates announced
NIST Post-Quantum Cryptography standardisationKyber selected by NIST
Draft FIPS 203 released
ML-KEM published as FIPS 203
HQC selected as a second KEM
NIST Post-Quantum Cryptography standardisation
How it works
- KeyGen samples a public matrix A from a seed and small secret and error vectors s and e, and publishes t = As + e.
- Encaps picks a random message m, derives encryption randomness from m and the public key, and encrypts m under the public key.
- The shared secret is derived from m with SHA-3 based functions, and the ciphertext is sent to the key holder.
- Decaps decrypts to recover m, re-encrypts it and checks the result matches the ciphertext.
- On a mismatch, decapsulation returns a pseudorandom secret derived from a stored rejection seed instead of an error.
Security notes
ML-KEM is considered sound and is NIST's recommended post-quantum KEM. Implementations must be constant time: timing leaks in decapsulation (for example the KyberSlash division issue in several Kyber libraries) have allowed key recovery. During the transition it is commonly deployed in hybrid mode alongside X25519 or ECDH.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| pk | 800 | Public key |
| sk | 1,632 | Secret key |
| ct | 768 | Ciphertext |
| ss | 32 | Shared secret |
| seed | 64 | Seed |
| coins | 32 | Encapsulation randomness |
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
pk, sk = ns.call("kem_keygen", "ml-kem-512", None, outs=2)
ct, ss = ns.call("kem_encaps", "ml-kem-512", None, pk, outs=2)
assert ss == ns.call("kem_decaps", "ml-kem-512", None, sk, ct)[0]
nextssl_kem_keygen("ml-kem-512", NULL, pk, sk);
nextssl_kem_encaps("ml-kem-512", NULL, pk, ct, ss);
nextssl_kem_decaps("ml-kem-512", NULL, sk, ct, ss);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_kem_in(reg::all(), Policy::Safe, "ml-kem-512", &Params::new())?;
let (pk, sk) = alg.keygen(&mut *rng)?;
let (ct, ss) = alg.encaps(&pk, &mut *rng)?;
assert_eq!(ss, alg.decaps(&sk, &ct)?);
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other ML-KEM variants
2Similar names
Looking for something else?More key encapsulation
All 110Frequently asked questions
What is ML-KEM-512?
ML-KEM-512 is a KEM in the ML-KEM family. ML-KEM is the Module-Lattice-Based Key-Encapsulation Mechanism standardised by NIST in FIPS 203. It is also known as mlkem512.
What are the ML-KEM-512 sizes?
In NextSSL, ML-KEM-512 uses: public key 800 bytes, ciphertext 768 bytes, shared secret 32 bytes.
Is ML-KEM-512 post-quantum?
Yes. ML-KEM-512 is a post-quantum kem: it is designed to resist attacks by large quantum computers. Its tier in NextSSL is safe.
Who designed ML-KEM-512 and when?
ML-KEM-512 belongs to the ML-KEM family, first published in 2024 by Roberto Avanzi, Joppe Bos, Léo Ducas, Eike Kiltz, Tancrède Lepoint, Vadim Lyubashevsky, John M. Schanck, Peter Schwabe, Gregor Seiler, Damien Stehlé (CRYSTALS-Kyber team). Its origin: NIST PQC standard (FIPS 203).
Which standards define ML-KEM-512?
ML-KEM-512 is referenced by FIPS 203. It is specified in a FIPS standard.
Is ML-KEM-512 safe to use?
ML-KEM-512 is in the safe tier. Modern and recommended. The default choice for new designs. It can be called from the safe API.
What other ML-KEM variants are there?
NextSSL also registers ml-kem-1024, ml-kem-768 in the ML-KEM family.
Related families
The Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
CRYSTALS-Kyber (Round 3)The Round 3 submission of Kyber, predecessor of the ML-KEM standard
ECDH (including X25519 and X448)Elliptic-curve Diffie-Hellman key agreement on NIST curves, Curve25519 and Curve448
HPKEHybrid Public Key Encryption: a KEM, a KDF and an AEAD combined per RFC 9180
ML-DSANIST's primary post-quantum signature scheme, standardised in FIPS 204
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2