Key encapsulation

HQC-256

Hamming Quasi-Cyclic: a code-based KEM chosen by NIST as a backup to ML-KEM

unverified Root API only Post-quantum
Unverified tier.

Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About HQC-256

HQC-256 is one of 3 HQC variants in the NextSSL registry, a key encapsulation mechanism. It uses a 7,245-byte public key, a 7,317-byte secret key, a 14,421-byte ciphertext and a 64-byte shared secret. It is designed to resist attacks by large quantum computers. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

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–2025
  1. NIST calls for post-quantum KEMs and signatures

    NIST Post-Quantum Cryptography standardisation
  2. HQC submitted to NIST PQC

  3. 26 candidates advance to round 2

    NIST Post-Quantum Cryptography standardisation
  4. Round 3 finalists and alternates announced

    NIST Post-Quantum Cryptography standardisation
  5. Advances to round 4

  6. FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) published

    NIST Post-Quantum Cryptography standardisation
  7. Selected by NIST as a second, code-based KEM

How it works

  1. KeyGen samples sparse secrets x and y and publishes h and s = x + h*y.
  2. Encaps encodes a random message with the concatenated Reed-Muller/Reed-Solomon code and masks it using s and fresh sparse noise.
  3. Decaps uses y to strip most of the mask and decodes the remaining errors.
  4. 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

Algorithm diversity alongside ML-KEM in case lattice assumptions weakenPost-quantum key establishment in hybrid protocolsResearch and interoperability testing ahead of the HQC standard

Sizes

FieldBytesMeaning
pk7,245Public key
sk7,317Secret key
ct14,421Ciphertext
ss64Shared secret
seed0Seed
coins0Encapsulation randomness

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'unverified' is reachable from the root API only
pk, sk = root.call("kem_keygen", "hqc-256", None, outs=2)
ct, ss = root.call("kem_encaps", "hqc-256", None, pk, outs=2)
assert ss == root.call("kem_decaps", "hqc-256", None, sk, ct)[0]

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other HQC variants

2

Frequently asked questions

What is HQC-256?

HQC-256 is a KEM in the HQC family. HQC is a key encapsulation mechanism whose security rests on decoding random quasi-cyclic codes rather than on lattices.

What are the HQC-256 sizes?

In NextSSL, HQC-256 uses: public key 7,245 bytes, ciphertext 14,421 bytes, shared secret 64 bytes.

Is HQC-256 post-quantum?

Yes. HQC-256 is a post-quantum kem: it is designed to resist attacks by large quantum computers. Its tier in NextSSL is unverified.

Who designed HQC-256 and when?

HQC-256 belongs to the HQC family, first published in 2017 by Carlos Aguilar Melchor, Nicolas Aragon, Slim Bettaieb, Loïc Bidoux, Olivier Blazy, Jean-Christophe Deneuville, Philippe Gaborit, Edoardo Persichetti, Gilles Zémor, et al.. Its origin: NIST PQC Round 4, selected for standardisation in 2025.

Is HQC-256 safe to use?

HQC-256 is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).

What other HQC variants are there?

NextSSL also registers hqc-128, hqc-192 in the HQC family.