Expand description
Pure Rust implementation of HQC-KEM (NIST FIPS 207).
HQC is a code-based Key Encapsulation Mechanism using quasi-cyclic codes over the ring Z_2[X]/(X^n-1). Uses concatenated Reed-Solomon + Reed-Muller error correction with Fujisaki-Okamoto transform for IND-CCA2 security.
§Usage
use hqc_kem::{Hqc128, HqcKem};
let mut rng = rand::rng();
let (ek, dk) = Hqc128::generate_key(&mut rng);
let (ct, ss1) = ek.encapsulate(&mut rng);
let ss2 = dk.decapsulate(&ct);
assert_eq!(ss1, ss2);§Security Levels
Hqc128/hqc128: NIST Level 1 (128-bit security)Hqc192/hqc192: NIST Level 3 (192-bit security)Hqc256/hqc256: NIST Level 5 (256-bit security)
§Features
kgen: Key generation (default)ecap: Encapsulation (default)dcap: Decapsulation (default)kem: RustCryptokem0.3 trait implementationspkcs8: PKCS#8 key encoding/decoding (requiresalloc)pem: PEM encoding (enablespkcs8/pem)alloc:Vec/Boxconversions and PKCS#8 encodingserde: Serde serialization supportstd: Standard library (default; enables runtime CPU feature detection)
The core KEM (kgen/ecap/dcap) is no_std and performs no heap
allocation.
Modules§
- hqc128
- HQC-128: NIST Level 1 security (128-bit).
- hqc192
- HQC-192: NIST Level 3 security (192-bit).
- hqc256
- HQC-256: NIST Level 5 security (256-bit).
Structs§
- Ciphertext
- HQC ciphertext.
- Decapsulation
Key - HQC decapsulation key (secret key).
- Encapsulation
Key - HQC encapsulation key (public key).
- Hqc128
Params - HQC-128 parameter marker (NIST Level 1, 128-bit security).
- Hqc192
Params - HQC-192 parameter marker (NIST Level 3, 192-bit security).
- Hqc256
Params - HQC-256 parameter marker (NIST Level 5, 256-bit security).
- HqcKem
- HQC Key Encapsulation Mechanism parameterized by security level.
- Shared
Secret - HQC shared secret.
Enums§
- Error
- Errors that can occur during HQC operations.
Traits§
- HqcParams
- Trait defining an HQC parameter set.