HQC
Code-based KEM selected by NIST in 2025.
from oxcrypto.kem.hqc_kem import HQC
private_key = HQC.HQC_128.generate()
ciphertext, shared_secret = private_key.public_key().encapsulate()
assert private_key.decapsulate(ciphertext) == shared_secret| Variant | Private key | Public key | Ciphertext | Shared secret |
|---|---|---|---|---|
HQC_128 | 32 bytes | 2241 bytes | 4433 bytes | 32 bytes |
HQC_192 | 32 bytes | 4514 bytes | 8978 bytes | 32 bytes |
HQC_256 | 32 bytes | 7237 bytes | 14421 bytes | 32 bytes |
Private keys serialize as the 32-byte seed_kem, which is the last 32 bytes of
the reference implementation's secret key.
Warning
Experimental. NIST selected HQC for standardization in March 2025; the FIPS draft is not yet published, and the parameters may change.
- Crate: RustCrypto
hqc-kem0.1.0-rc.0, pre-release, no published audit. Builds with Rust 1.88. - Vectors: HQC reference implementation KATs
hqc-1.rsp,hqc-3.rspandhqc-5.rsp(count 0), from RustCrypto/KEMshqc-kem/kat.
Zeroization
Retained state: the full secret key (PKE secret, sigma, seed_kem). The
upstream DecapsulationKey wipes it on drop and the upstream key generation
wipes its seed intermediates.
Short-lived copies not wiped by the upstream crate: the 32-byte private seed
copies the kem trait adapter makes in generate and load_private_key,
decapsulation intermediates, and the shared-secret array the adapter returns
before oxcrypto copies it into a wiped buffer.
oxcrypto enables the zeroize features of sha3 and shake, so the upstream
SHA-3 and SHAKE states are wiped on drop.