HQC support sampling #
SampleSupport2 first draws independent fixed-width words, scales each word by multiply-high
into a shrinking interval, then processes the candidates in descending index order. A candidate
already present among the corrected later entries is replaced by its index.
The word source here consists of independent fair bits. Relating an XOF to that ideal source is a separate cryptographic obligation. This module does not analyze decryption failure or security.
Main definitions #
Cslib.Crypto.HQC.resolveSupport: the descending collision-replacement pass.Cslib.Crypto.HQC.sampleSupportFrom: draw every candidate before resolving collisions.Cslib.Crypto.HQC.sampleSupport2: the finite-bit algorithm, with a generalized word width.
Main results #
Cslib.Crypto.HQC.toFinset_scanSupport: the source array pass agrees with the set resolver.Cslib.Crypto.HQC.sampleSupport2_mem_powersetCard: actual outputs have exactly the given weight.Cslib.Crypto.HQC.eval_idealSupport: ideal interval draws give uniform fixed-weight supports.Cslib.Crypto.HQC.eval_sampleSupport2: the exact actual law as a map of uniform word arrays.
References #
- HQC specification, version 5.1,
SampleSupport2, p. 19, and §6.2.3, Proposition 6.2.1, p. 65. The expression on algorithm line 5 is multiply-high, despite the accompanying comment mentioning reduction modulo the interval length.
The source array pass, including the complete increasing scan through corrected later
entries. This retains the ordered array, whereas resolveSupport retains its support set.
The source's nested array scan and membership-based descending resolver have exactly the same output support, even for candidates outside the sampling range.
One step of the candidate array followed by the recursive suffix and reverse resolution.
The source's line 5, using independent fair bits in place of the XOF words.
Ideal uniform selection from the shrinking interval. The value outside a nonempty interval
is only a totality convention; all uniformity theorems require offset + count ≤ n.
The ideal candidate is uniform on the complete shrinking interval.
Independent exact uniform candidates give an exact uniform fixed-cardinality support.
A word consists of exactly width fair bits, and line 5 uses multiply-high.
Every actual candidate is in its shrinking interval.
The actual finite-bit sampler always returns exactly the requested number of positions.
At full weight every word array produces the entire support.
At weight zero the program makes no random choices and returns the empty support.
The actual algorithm is exactly its deterministic word-array map under independent uniform words. In particular, this law retains the multiply-high bias.