The ideal algebraic HQC public-key encryption core #
This file formalizes the binary algebra of HQC-PKE after its seeds and XOF streams have been
expanded. It follows [GAMA+26], §3.6, Algorithms HQC-PKE.Keygen, HQC-PKE.Encrypt and
HQC-PKE.Decrypt, pp. 38–40. The public ring is represented by bit strings and multiplication by
Mathlib's circulant matrix-vector product, consistently with the HQC syndrome distributions.
The ideal key generator draws y, then x, uniformly at fixed weight ω, followed by uniform h;
it publishes (h, s = x + h * y) and retains y as the secret key. Encryption draws (r₂, e, r₁)
at weights (ωᵣ, ωₑ, ωᵣ) in the source order and returns
(u, v) = (r₁ + h * r₂, Encode(m) + Truncate(s * r₂ + e, ℓ)). Here Truncate(_, ℓ) removes
the last ℓ coordinates, so its result has length n - ℓ. Decryption applies Decode to
v - Truncate(u * y, ℓ); subtraction is addition in the Boolean ring.
The decryption phase is the encoded message plus the retained prefix of
e' = x * r₂ - r₁ * y + e. Consequently any decoder that corrects every error of weight at most
Δ recovers the message whenever that retained error has weight at most Δ.
This is an ideal expanded-value model, not the byte-level scheme. In particular, it does not model seed splitting, XOF state, byte encodings, the concrete concatenated Reed–Muller/Reed–Solomon code, primitive-prime admissibility, the decryption-failure rate, or any PKE/KEM security claim.
Main definitions #
Cslib.Crypto.HQC.PKEParams: ideal algebraic parameters and their finite support bounds.Cslib.Crypto.HQC.pkeKeyGen,Cslib.Crypto.HQC.pkeSampleCoins: the ideal expanded samplers.Cslib.Crypto.HQC.pkeEncrypt,Cslib.Crypto.HQC.pkeDecrypt: deterministic HQC-PKE.Cslib.Crypto.HQC.DecoderCorrects: bounded-error correction for plain encoder/decoder functions.Cslib.Crypto.HQC.toExplicitCoinPKE: the core as an explicit-coin PKE.
Main results #
Cslib.Crypto.HQC.pkeDecryptInput_encrypt: the exact retained-error phase identity.Cslib.Crypto.HQC.pkeDecrypt_encrypt_eq_of_weight_le: deterministic bounded-error correctness.Cslib.Crypto.HQC.pkeKeyGen_support,Cslib.Crypto.HQC.pkeSampleCoins_support: sampled keys and coins have exactly the source's fixed weights.Cslib.Crypto.HQC.pkeKeyGen_expect: expectation under ideal expanded key generation in exact source sampling order.
References #
- HQC specification, version 5.1, §3.6, pp. 38–40.
Parameters of the ideal algebraic HQC-PKE core. The source uses positive values and
0 < ℓ < n; this finite model also admits boundary cases, while retaining all sampling bounds
needed to define the fixed-weight laws.
- n : ℕ
Length
nof vectors in the quasi-cyclic ring. - k : ℕ
Message length
k. - ell : ℕ
Number
ℓof trailing coordinates removed from ring words. - omega : ℕ
Secret-vector weight
ω. - omegaR : ℕ
Encryption-vector weight
ωᵣ. - omegaE : ℕ
Encryption-error weight
ωₑ. - delta : ℕ
Number
Δof retained errors corrected by the code. Truncation cannot remove more than the complete ring word.
Secret supports fit in the ring word.
Encryption-vector supports fit in the ring word.
Encryption-error supports fit in the ring word.
Length n - ℓ of the codeword and second ciphertext component.
A ring word in the ideal HQC algebra.
An HQC-PKE message.
A word in the image space of the inner error-correcting code.
The expanded HQC-PKE secret key is the fixed-weight word y. The key-generation witness x
is intentionally not part of the decryption key.
The ideal ring-word sampler is exactly uniform on the requested weight layer.
Every supported ideal sample has exactly the requested weight.
The expanded public key determined by public word h and secret witnesses x, y.
Ideal expanded HQC-PKE key generation. It samples y before x, as the source does, and
returns only y as the decryption key.
Every supported key pair has fixed-weight witnesses for the published syndrome, while the
actual secret key is exactly the sampled y.
Expectation under ideal expanded key generation, exposing the exact source order y, x,
then h without exposing the sampler implementation itself.
Expectation under ideal encryption-coin sampling, exposing the exact independent source order
r₂, e, then r₁ without exposing the sampler implementation itself.
Every supported encryption coin triple has exactly the source's three fixed weights.
Deterministic expanded HQC-PKE encryption.
The word supplied to the error-correcting decoder during decryption. Subtraction in the source is addition in the Boolean ring.
Deterministic expanded HQC-PKE decryption.
HQC-PKE decryption phase. For an honestly formed expanded key and ciphertext, the decoder
input is the encoded message plus the retained prefix of
e' = x * r₂ - r₁ * y + e.
A decoder corrects up to Δ errors when it recovers every message from its encoding plus any
error word of Hamming weight at most Δ. This follows the plain encoder/decoder convention used
by the binary symmetric channel API, without introducing a separate code hierarchy.
Deterministic bounded-error correctness of ideal HQC-PKE.
The ideal algebraic HQC core as an explicit-coin public-key encryption scheme. Decryption is
total, so its result is wrapped in some.