Has it been Pwned

How HQC works

The sender hides an encoded random message under binary noise. The receiver removes a shared masking term, leaving a word that a public error-correcting code can usually repair.

Program status. NIST selected HQC in March 2025. Standardization continues. This guide uses the designers’ November 9, 2026 version 5.1, including its truncation and KEM transform. NIST program history

Two different jobs for codes

A receiver can often repair a noisy transmission if the sender added suitable redundancy. In HQC, everyone knows that error-correcting code and its decoder. What a stranger lacks is the information needed to turn the public ciphertext into a word close enough for that decoder. The private and public values are arranged so the receiver can cancel a dense product, exposing an encoded message mixed with much less noise.

HQC represents a binary vector by a polynomial whose coefficients are its bits. Addition is XOR. Multiplication wraps positions cyclically by reducing modulo Xⁿ − 1. A sparse vector contains relatively few ones. Choosing secrets of prescribed small Hamming weight, the number of ones, makes the residual noise manageable. The hardness assumptions concern distinguishing structured, noisy quasi-cyclic syndromes. The specification accounts for the parity restrictions and truncation that occur in the actual distributions.

How the large term cancels

s = x + h y; u = r₁ + h r₂; v = C(m) + T(s r₂ + e)

h is public, x and y are sparse private vectors, and s is public. The sender uses fresh sparse r₁, r₂ and e. C encodes the random message m, and T truncates the cyclic vector to the length of the codeword. The ciphertext core is (u, v).

Adding T(uy) to v cancels T(hyr₂), since adding the same bits twice gives zero. The result is C(m) + T(xr₂ + r₁y + e). The outer shortened Reed-Solomon code operates on symbols. A duplicated Reed-Muller code encodes each symbol into bits. The inner decoder and then the outer decoder work together to remove residual errors. Correctness depends on the distribution of that residue.

Worked example

A repetition code sends the bit 1 as 111. A receiver of 101 chooses 1 by majority vote. This miniature example illustrates why redundancy helps after cancellation. HQC uses its specified concatenated code, and the residual errors arise from products of sparse vectors rather than an independent coin flip at every position.

How a KEM uses the code

  1. Generate

    Use fresh seed material to generate h, the sparse secrets and s. Publish the seed for h and the vector s. The decapsulation key can regenerate the private quantities it needs.

  2. Encapsulate

    Choose an internal random message and a salt. Derive the shared key and encryption randomness from the public-key digest, message and salt. Send the two ciphertext components and the salt.

  3. Decapsulate

    Decode the noisy word, repeat the prescribed encryption and compare ciphertexts. On a failed consistency check, the scheme produces a secret-derived fallback. The protocol receives key bytes, while internal decoder decisions stay private.

What a failure rate measures

A correctly formed encapsulation can, with small probability, leave more noise than the decoder can correct. This probability, and the evidence supporting its estimate, matter separately from the cost of recovering the private key. The designers updated parameters and their failure analysis in version 5.1. Implementations must match the same revision, including sampling, truncation and the decapsulation-key format. A public decoder still handles secret-dependent intermediate values inside the receiver, so timing and memory-access behavior remain relevant there.

Where HQC implementations can leak

Power studies found leakage from the error-correcting decoder and polynomial multiplication. Researchers recovered keys on specific Cortex-M4 and FPGA builds. A separate replay study found that adding a masking countermeasure made its target easier to measure. Compare each test by device, operation and physical access.

Read the study and its scope →

HQC-1 decoder power study →

HQC polynomial multiplication study →

EUROCRYPT proposal for smaller HQC ciphertexts →

Primary sources

Construction and program sources reviewed .