ML-KEM

Also known as: Module-Lattice-Based Key-Encapsulation Mechanism · CRYSTALS-Kyber · Kyber · FIPS 203

On this page 8

ML-KEM, the Module-Lattice-Based Key-Encapsulation Mechanism, is the post-quantum algorithm standardized by NIST in FIPS 203 that lets two parties establish a shared secret key over an insecure channel, with security resting on the hardness of lattice problems that quantum computers are not known to solve efficiently. In quantum security, it is the primary replacement for RSA and elliptic-curve key exchange, both of which fall to Shor’s algorithm on a sufficiently large machine.

ML-KEM grew out of CRYSTALS-Kyber, the winning key-establishment submission in the NIST PQC standardization process, and is often still called Kyber. The final standard was published in August 2024 and is now deployed in browsers, TLS libraries, messaging protocols and VPNs, usually combined with a classical algorithm in hybrid key exchange.

How ML-KEM encapsulates a shared key

ML-KEM works as a key-encapsulation mechanism (KEM) rather than as general-purpose encryption: it generates and transports a fresh random secret instead of encrypting a chosen message. The interface consists of three algorithms, which together replace the Diffie-Hellman handshake familiar from classical protocols.

  1. KeyGen produces an encapsulation key (public) and a decapsulation key (private).
  2. Encaps takes the encapsulation key and outputs a ciphertext plus a 32-byte shared secret.
  3. Decaps takes the decapsulation key and the ciphertext and recovers the same 32-byte secret.

Internally, ML-KEM first builds a public-key encryption scheme called K-PKE and then hardens it with a variant of the Fujisaki-Okamoto transform. The transform re-encrypts the decrypted value during decapsulation and compares the result with the received ciphertext. If they differ, the algorithm returns a pseudorandom value derived from a secret seed, a technique known as implicit rejection. This design gives IND-CCA2 security, meaning an attacker who can submit chosen ciphertexts still learns nothing useful about the key.

The following table summarizes the role of each component in a typical exchange.

ComponentHeld byPurpose
Encapsulation keyPublished by the receiverLets anyone encapsulate a secret to the receiver
Decapsulation keyKept private by the receiverRecovers the secret from a ciphertext
CiphertextSent by the initiatorCarries the encapsulated secret
Shared secretDerived by both sidesFeeds a key derivation function for session keys
Components of an ML-KEM exchange

The module-lattice mathematics behind ML-KEM

The security of ML-KEM rests on the Module Learning With Errors (MLWE) problem, a structured form of learning with errors. An attacker sees a public matrix A and a vector t = As + e, where s and e are small secret polynomials. Recovering s requires solving a noisy linear system, and the best known classical and quantum algorithms for this task run in exponential time.

All arithmetic happens in the polynomial ring of degree n = 256 with coefficients modulo the prime q = 3329. The module rank k (2, 3 or 4) sets the size of the matrix and therefore the security level. Multiplication uses the number-theoretic transform (NTT), a finite-field analogue of the fast Fourier transform, which makes ML-KEM faster than X25519 on many processors despite its larger messages.

Ciphertexts are compressed by dropping low-order bits, which shortens them but adds a small amount of noise. As a result, decryption can fail with a tiny, quantified probability, between roughly 2^-139 and 2^-174 depending on the parameter set, which is far below any practical concern.

ML-KEM parameter sets and key sizes

FIPS 203 defines three parameter sets that map to NIST security categories, where category 1 is comparable to AES-128, category 3 to AES-192 and category 5 to AES-256. The table lists the byte sizes of each object.

Parameter setModule rank kNIST categoryEncapsulation keyCiphertext
ML-KEM-51221800 bytes768 bytes
ML-KEM-768331,184 bytes1,088 bytes
ML-KEM-1024451,568 bytes1,568 bytes
ML-KEM parameter sets in FIPS 203

ML-KEM-768 is the default choice for most systems because it offers a comfortable margin against future cryptanalysis at modest cost. ML-KEM-1024 is required for national security systems under the US CNSA 2.0 suite, while ML-KEM-512 suits constrained links where every byte matters. The decapsulation key is larger still, from 1,632 to 3,168 bytes, because it stores the encapsulation key and a hash alongside the secret vector.

How ML-KEM compares with classical and other post-quantum schemes

ML-KEM trades larger public data for quantum resistance and strong performance. The comparison below places it next to the algorithms it replaces and the alternatives it competes with.

SchemeHard problemPublic key sizeQuantum resistant
X25519Elliptic-curve discrete logarithm32 bytesNo
RSA-3072Integer factorizationAbout 384 bytesNo
ML-KEM-768Module learning with errors1,184 bytesYes
HQCDecoding quasi-cyclic codesAbout 2.2 to 7.2 KBYes
Classic McElieceDecoding binary Goppa codesAbout 261 KB to 1.3 MBYes
ML-KEM compared with related key-establishment schemes

NIST selected HQC in 2025 as a backup KEM based on a different mathematical family, so that a breakthrough against lattices would not leave the ecosystem without a standardized option. ML-KEM handles key establishment only; digital signatures are covered by its companion standards ML-DSA, SLH-DSA and FN-DSA.

Deploying ML-KEM in real protocols

Most deployments today use ML-KEM inside hybrid key exchange, combining it with a classical algorithm so that the session stays secure if either component is broken. The TLS 1.3 group X25519MLKEM768 concatenates the outputs of X25519 and ML-KEM-768 and is enabled by default in major browsers and content delivery networks. The main motivation is the harvest now, decrypt later threat, in which adversaries record encrypted traffic today to decrypt it once a cryptographically relevant quantum computer exists.

The decision table below reflects common engineering practice.

SituationRecommended choiceReason
Public web traffic over TLS 1.3X25519MLKEM768 hybridBroad support and defense in depth
National security systemsML-KEM-1024Mandated by CNSA 2.0
Long-lived archives or VPN tunnelsML-KEM-768 or 1024 in hybrid modeData must stay confidential for decades
Constrained IoT radio linksML-KEM-512Smallest messages at category 1
Choosing an ML-KEM configuration

Because the encapsulation key exceeds 1 KB, the larger ClientHello message can split across TCP packets, and some poorly written middleboxes have dropped such handshakes. Testing network paths is therefore part of any quantum-safe migration, together with a cryptographic inventory and a crypto-agile design that allows parameters to change later.

Limitations and implementation pitfalls

The mathematics of ML-KEM is well studied, but most real risks lie in implementations. The KyberSlash findings of 2023 and 2024 showed that a division by a secret-dependent value could leak key bits through timing side channels on some processors. Key points to watch are listed below.

  • Constant-time code is mandatory; no branches or memory accesses may depend on secret data.
  • Implicit rejection must be implemented exactly, or chosen-ciphertext attacks become possible.
  • Key reuse is safe for ML-KEM, unlike some earlier lattice proposals, but ephemeral keys still give forward secrecy.
  • Masking against power analysis is needed on smart cards and embedded devices exposed to physical attackers.
  • Confidence in lattice hardness is high, yet it is younger than confidence in factoring, which is why hybrid deployment remains the cautious default.

In simple terms

ML-KEM is a way for two computers to agree on a secret password while strangers listen to every word they exchange. One side publishes an open padlock. The other side locks a random secret inside a box with that padlock and sends the box back. Only the owner of the matching key can open it.

Today, most of the internet uses padlocks that a future quantum computer could pick. ML-KEM is a new kind of padlock built from a math puzzle full of deliberate noise, and no known computer, quantum or ordinary, can solve that puzzle in reasonable time. The key takeaway is simple: it keeps private conversations private even after quantum computers arrive.

A practical example

A regional hospital network stores patient records that must remain confidential for at least 30 years. Its security team worries that traffic between clinics and the central data center could be recorded now and decrypted later. During a scheduled upgrade, the team enables the X25519MLKEM768 hybrid group on its TLS 1.3 load balancers and reconfigures site-to-site VPN tunnels to use ML-KEM-768 alongside the existing elliptic-curve exchange.

Testing reveals that one older firewall drops handshakes once the ClientHello grows by about 1,200 bytes, so the team updates its firmware before rollout. After deployment, handshake latency rises by less than one millisecond on average, and every new session now carries quantum-resistant protection for the data that matters most.