HQC
Hamming Quasi-Cyclic: a code-based KEM chosen by NIST as a backup to ML-KEM
Overview
HQC is a key encapsulation mechanism whose security rests on decoding random quasi-cyclic codes rather than on lattices. NIST selected it in 2025 for standardisation as a second, structurally different KEM to complement ML-KEM.
HQC works in the ring F2[X]/(X^n - 1) with n prime, so public keys and ciphertexts consist of a few long binary polynomials. The public key is a noisy syndrome built from two sparse secret polynomials. Encryption encodes the message with a public error-correcting code, a concatenation of a Reed-Muller and a Reed-Solomon code, and masks it with fresh sparse noise. The decryptor removes most of the mask with its secret key and corrects the remaining errors with the public code.
Unlike McEliece, the error-correcting code in HQC is public and carries no secret structure; security comes from the hardness of the quasi-cyclic syndrome decoding problem. An IND-CCA2 KEM is obtained with a Fujisaki-Okamoto style transform. Because the decoder has a small but non-zero failure rate, parameters are chosen to keep the decryption failure probability below 2^-128 or lower. The scheme is also simple to implement in hardware.
Three parameter sets are present: HQC-128, HQC-192 and HQC-256, targeting NIST categories 1, 3 and 5. Public keys are roughly 2.2 KB to 7.2 KB and ciphertexts about 4.4 KB to 14.4 KB, larger than ML-KEM but far smaller than Classic McEliece. NIST has announced it will publish a separate standard based on HQC, intended as a backup rather than a replacement for ML-KEM.
History
2016–2025NIST calls for post-quantum KEMs and signatures
NIST Post-Quantum Cryptography standardisationHQC submitted to NIST PQC
26 candidates advance to round 2
NIST Post-Quantum Cryptography standardisationRound 3 finalists and alternates announced
NIST Post-Quantum Cryptography standardisationAdvances to round 4
FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) published
NIST Post-Quantum Cryptography standardisationSelected by NIST as a second, code-based KEM
How it works
- KeyGen samples sparse secrets x and y and publishes h and s = x + h*y.
- Encaps encodes a random message with the concatenated Reed-Muller/Reed-Solomon code and masks it using s and fresh sparse noise.
- Decaps uses y to strip most of the mask and decodes the remaining errors.
- The message is re-encrypted and checked, and the shared key is hashed from it.
Security notes
No structural attack is known, but several timing side channels in earlier HQC implementations (in sampling and decoding) have been published and fixed in later revisions. The final NIST standard may differ in detail from the specification wired into NextSSL, so outputs may not match the eventual FIPS text.
Typical uses
Variants in NextSSL
3| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| HQC-128 hqc-128 |
unverified | pk 2249 · sk 2305 · ct 4433 · ss 64 · seed 0 · coins 0 | — | root |
| HQC-192 hqc-192 |
unverified | pk 4522 · sk 4586 · ct 8978 · ss 64 · seed 0 · coins 0 | — | root |
| HQC-256 hqc-256 |
unverified | pk 7245 · sk 7317 · ct 14421 · ss 64 · seed 0 · coins 0 | — | root |
Frequently asked questions
Which HQC variants does NextSSL include?
NextSSL registers 3 HQC variants: hqc-128, hqc-192, hqc-256.