Asymptotic second-preimage resistance on bit strings #
A function f is second-preimage resistant ([BS23], Section 8.11.1, Definition 8.6,
p. 336) when, given a uniformly sampled input x and the unary security parameter n, every
efficient adversary has negligible probability of finding x' ≠ x with f x' = f x.
In Boneh–Shoup Definition 8.6 (m' ∈ M), the adversary's answer is restricted to the message space.
secondPreimageGameOn f valid and SecondPreimageResistantOn f valid model that restriction via
a parameter-indexed validity predicate valid : ℕ → List Bool → Bool (so
valid := fun n w => decide (w.length = n) gives Definition 8.6 on M = {0,1}ⁿ), while
secondPreimageGame and SecondPreimageResistant (valid := fun _ _ => true) accept an answer
x' of any length, matching the any-length preimage convention of Cslib.Crypto.OneWay.
This module defines the valid-domain game secondPreimageGameOn and its any-length specialization
secondPreimageGame, SecondPreimageResistantOn, and the any-length abbrev
SecondPreimageResistant (valid := fun _ _ => true), along with .of_injective and
not_secondPreimageResistantOn_const. The monad-generic finite experiment and distributional bounds
of Exercise 8.23(a)–(b) live in CslibFrontier.Crypto.Game.SecondPreimage; the certified bit-string
reductions of (8.17), Exercise 8.23(b)–(d), and Theorem 8.12 live in follow-on modules.
Main definitions #
Cslib.Crypto.SecondPreimageFinder:ℕ → List Bool → ProbComp (List Bool).Cslib.Crypto.secondPreimageGameOn: second-preimage game on uniformn-bit inputs accepting onlyvalid n-valid distinct collisions.Cslib.Crypto.secondPreimageGame:secondPreimageExperimenton uniformn-bit inputs (answers of any length accepted).Cslib.Crypto.SecondPreimageResistantOn: polynomial-time evaluation and negligible success insecondPreimageGameOnfor every uniform strict PPTSecondPreimageFinder.Cslib.Crypto.SecondPreimageResistant:SecondPreimageResistantOn f (fun _ _ => true)(stronger any-length variant).
Main results #
Cslib.Crypto.isPPTOn_secondPreimageGame,Cslib.Crypto.isPPT_secondPreimageGame: the second-preimage experiment is uniformly strict PPT.Cslib.Crypto.SecondPreimageResistantOn.of_injective: any polynomial-time function that is injective among valid answers colliding withn-bit inputs is unconditionally second-preimage resistant.Cslib.Crypto.not_secondPreimageResistantOn_const: constant functions are not second-preimage resistant.
References #
- D. Boneh and V. Shoup, A Graduate Course in Applied Cryptography, Section 8.11.1, Definition 8.6, p. 336.
A second-preimage finder receives the unary parameter and the sampled input word.
The valid-domain second-preimage game at length n ([BS23], Section 8.11.1,
Definition 8.6, p. 336): draw x ← BitString.sampleList n, run x' ← adversary n x, and accept
when valid n x', x' ≠ x, and f x' = f x. When valid n w = decide (w.length = n), this is
Definition 8.6 on M = {0,1}ⁿ.
The second-preimage game at length n: secondPreimageExperiment for f on a uniform n-bit
input, with the finder told n. This specializes secondPreimageGameOn to valid := fun _ _ => true, accepting any x' ≠ x with f x' = f x regardless of length.
Run the complete second-preimage experiment on its unary parameter.
The second-preimage experiment is uniformly PPT, independently of the unused auxiliary input.
One plain polynomial-time algorithm evaluates the function, and every uniform strict PPT
second-preimage finder has negligible success in secondPreimageGameOn f valid over the uniform
n-bit input and its own independent random coins ([BS23], Section 8.11.1,
Definition 8.6, p. 336). When valid n w = decide (w.length = n), this states Definition 8.6 on
M = {0,1}ⁿ.
- polyTime : Turing.MultiTapeTM.ComputableInPolyTime f Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits
A deterministic polynomial-time algorithm evaluates the function.
- secure : Game.Indistinguishable (fun (adversary : SecondPreimageFinder) (n : ℕ) => (secondPreimageGameOn f valid adversary n).eval) (fun (x : SecondPreimageFinder) (x_1 : ℕ) => PMF.pure false) (Probability.IsPPT Turing.MultiTapeTM.encBits)
Valid-domain second-preimage search is indistinguishable from certain failure in the common game calculus.
Second-preimage resistance on valid yields negligible winning probability in
secondPreimageGameOn for every uniform strict PPT finder.
Establish SecondPreimageResistantOn by proving negligible winning probability for every
uniform strict PPT finder.
Compare two secondPreimageGameOn runs when every winning (x, x') pair in the first
(x.length = n, valid₁ n x', x' ≠ x, f₁ x' = f₁ x) satisfies valid₂ n x' and
f₂ x' = f₂ x.
Shrinking the valid answer predicate preserves second-preimage resistance.
A polynomial-time function that has no valid second preimages colliding with n-bit inputs is
unconditionally second-preimage resistant on valid.
Winning secondPreimageGameOn eventually with probability bounded away from zero refutes
SecondPreimageResistantOn.
A deterministic function g producing valid distinct colliding answers on every n-bit input
wins secondPreimageGameOn f valid at length n with probability 1.
Any constant function is not second-preimage resistant on any validity predicate that admits the
head-flipped word on n-bit inputs for sufficiently large n (in particular,
valid n w := decide (w.length = n) or fun _ _ => true).
Any-length second-preimage resistance on bit strings (novel to this library: strengthens
SecondPreimageResistantOn f (fun n w => decide (w.length = n)), which is
[BS23], Section 8.11.1, Definition 8.6, p. 336, by accepting answers x' of any
length, matching Cslib.Crypto.OneWay; plausible because CollisionResistantToOneWay.keyDigest H
satisfies it for every collision-resistant HashFamily H).