Shoup XOR-masking composition ([Shoup2000], [HHRVW2020] Lemma 5.7) #
This module formalizes Shoup's XOR-masking composition theorem ([Shoup2000]; restated as
[HHRVW2020], Section 5.1.4, Lemma 5.7, pp. 29–30), stretching a target collision-resistant
shrinking compression function
$H_K : \{0, 1\}^{b + s} \to \{0, 1\}^b$ ($s \ge 1$) to $t$ sequential steps with a single shared
subkey $K$ and $\lfloor \log_2 t \rfloor + 1$ public $b$-bit XOR masks (O(|K| + b log t) total
key bits):
- XOR-masked sequential cascade (
shoupState,shoupCascade,exists_shoupCascade_step_collision): iteratesi = 1, ..., twith maskBitString.listRow b (padicValNat 2 i) masksands-bit chunkshoupChunk b s i x, extracting an in-range step collision (1 ≤ i ≤ t) from any fixed-length message collision whenb ≤ L ≤ b + t * s. - Mask-reconstruction bijection (
shoupPackMasks,shoupStepInput_shoupPackMasks,uniformList_map_shoupPackMasks,computableInPolyTime_shoupPackMasks): reconstructs the XOR masks via one downward scan using binary trailing-zero (padicValNat 2) last-occurrence breakpoints, proving both that stepiStarreceiveslistRow b (padicValNat 2 iStar) T ++ shoupChunk b s iStar xand thatT ↦ shoupPackMasks ... TpreservesBitString.uniformList (shoupMasksLen b t)via an explicit left-inverse. - Target collision-resistant composition (
shoupComposeKeyLen,shoupComposeEval,shoupComposeChoose,shoupComposeFindWith,shoupComposeAdversary,targetCollisionResistantOn_shoupCompose): packages[Shoup2000]/[HHRVW2020]Lemma 5.7 withO(|y| log t)key length (shoupComposeKeyLen_le) and explicit multiplicative lossdyadicSize (t n), exposing the pre-key and post-key reduction stages so downstream candidate concatenations can reuse them directly.
Main definitions #
Cslib.Crypto.shoupMaskCount,Cslib.Crypto.shoupMasksLen: number and total bit length of the $\lfloor \log_2 t \rfloor + 1$ XOR masks.Cslib.Crypto.shoupChunk,Cslib.Crypto.shoupStepInput,Cslib.Crypto.shoupState,Cslib.Crypto.shoupCascade: Shoup's $\nu_2(i)$-indexed XOR-masked sequential cascade.Cslib.Crypto.shoupPackMasks: polynomial-time mask-reconstruction algorithm ([Shoup2000];[HHRVW2020], Section 5.1.4, Lemma 5.7, pp. 29–30).Cslib.Crypto.shoupComposeKeyLen,Cslib.Crypto.shoupComposeEval,Cslib.Crypto.shoupComposeChoose,Cslib.Crypto.shoupComposeFindWith,Cslib.Crypto.shoupComposeAdversary: standalone[HHRVW2020]Lemma 5.7 construction and reduction stages.
Main results #
Cslib.Crypto.exists_shoupCascade_step_collision: deterministic step-collision extractor from a distinct equal-length message collision onshoupCascade.Cslib.Crypto.shoupStepInput_shoupPackMasks: planted target input at stepiStar.Cslib.Crypto.uniformList_map_shoupPackMasks: exact uniform distribution of constructed masks.Cslib.Crypto.shoupComposeKeyLen_le:keyLen n + (Nat.log 2 (t n) + 1) * b n ≤ (Nat.log 2 (t n) + 2) * keyLen nwhenb n ≤ keyLen n(O(|y| log t)bound).Cslib.Crypto.succProbability_targetCollisionGame_shoupCompose_le,Cslib.Crypto.targetCollisionResistantOn_shoupCompose:[Shoup2000]/[HHRVW2020]Lemma 5.7 concrete and asymptotic security theorems with lossdyadicSize (t n).
References #
2-adic valuation combinatorics ([Shoup2000]; [HHRVW2020], Lemma 5.7, pp. 29–30) #
Mask-count schedule and XOR-masked cascade ([Shoup2000]; [HHRVW2020] Lemma 5.7) #
Number ⌊log₂ t⌋ + 1 of b-bit XOR masks needed for a t-step Shoup cascade.
Total mask bit length (⌊log₂ t⌋ + 1) * b for t steps and chaining width b.
Deterministic step-collision extraction from any equal-length collision on shoupCascade.
Shoup XOR-mask reconstruction ([Shoup2000]; [HHRVW2020] Lemma 5.7, p. 30) #
Shoup's XOR-mask reconstruction algorithm ([Shoup2000]; [HHRVW2020] Lemma 5.7, p. 30):
given base step step, target message x, planted collision step iStar (1 ≤ iStar ≤ t),
and uniform random block vector T of length shoupMasksLen b t, builds the
shoupMasksLen b t-bit mask list M satisfying both planted-input equality at iStar and exact
uniformity.
Shoup's mask-reconstruction map preserves BitString.uniformList (shoupMasksLen b t)
whenever 1 ≤ iStar ≤ t.
Standalone Shoup composition ([Shoup2000], [HHRVW2020] Lemma 5.7) #
O(|y| log t) key-length bound: whenever outLen n ≤ baseKeyLen n, the composed key has
length at most (Nat.log 2 (t n) + 2) * baseKeyLen n.
Composed evaluator applying t n steps of shoupCascade to base evaluator h n key where
key := BitString.listRow (baseKeyLen n) 0 K and masks := K.drop (baseKeyLen n).
Pre-key target-selection stage of Shoup's Lemma 5.7 reduction ([Shoup2000]; [HHRVW2020],
Section 5.1.4, Lemma 5.7, p. 30): samples a dyadic cascade step guess rawSlot, runs
adversary.choose n, draws a uniform mask-seed vector T, and outputs the (outLen n + s n)-bit
planted step target w₀ together with the encoded state passed to shoupComposeFindWith.
Post-key collision-extraction stage of Shoup's Lemma 5.7 reduction ([Shoup2000];
[HHRVW2020], Section 5.1.4, Lemma 5.7, p. 30): decodes savedState, normalizes k to
baseKeyLen bits, reconstructs the masks via shoupPackMasks for stepOfKey key, runs
adversary.find n st.advState (key ++ masks), and returns the step-iStar input.
Reduction adversary turning a target collision finder on shoupComposeEval into a target
collision finder on the underlying shrinking compression function h, guessing the colliding step
1 ≤ iStar ≤ t n and reconstructing the log t-mask vector via shoupPackMasks ([Shoup2000];
[HHRVW2020], Section 5.1.4, Lemma 5.7, p. 30).
shoupComposeAdversary is uniformly strict PPT whenever adversary is strict PPT and all
parameters and h are polynomial time.
Concrete [Shoup2000] / [HHRVW2020] Lemma 5.7 reduction: the target-collision
advantage of adversary against shoupComposeEval on L n-bit inputs (outLen n ≤ L n ≤ outLen n + t n * s n) is at most dyadicSize (t n) times the target-collision advantage of
shoupComposeAdversary against h on (outLen n + s n)-bit inputs.
Asymptotic [Shoup2000] / [HHRVW2020] Lemma 5.7: if h is target collision
resistant on (outLen n + s n)-bit inputs with 1 ≤ s n and outLen n ≤ L n ≤ outLen n + t n * s n, then shoupComposeEval is target collision resistant on L n-bit inputs
with compact key length baseKeyLen n + (Nat.log 2 (t n) + 1) * outLen n.