Implications and separations for second-preimage resistance #
This module formalizes the hierarchy $$\text{collision resistance} \implies \text{second-preimage resistance} \implies \text{one-wayness}$$ of [BS23], Section 8.11.1, equation (8.17), p. 337, together with Exercise 8.23(b)–(d), p. 353, and the two strict-separation constructions on bit strings:
- Second-preimage resistance implies one-wayness under super-polynomial compression
((8.17), second arrow, and Exercise 8.23(b) on bit strings): one-wayness is
OneWayOnon the same domainvalidas second-preimage resistance, both Definition 8.6.inverterToSecondPreimage f adversaryfeedsf mto anInverter, withisPPT_inverterToSecondPreimage, the concrete boundsuccProbability_inversionGameOn_le_secondPreimageGameOn_add, and the asymptotic implicationSecondPreimageResistantOn.oneWayOn_of_outputLengthwhen2 ^ outLen n / 2 ^ nis negligible. - Collision resistance implies second-preimage resistance ((8.17), first arrow, and
Exercise 8.23(d)): the book states this for an unkeyed collision-resistant hash
H; becauseHashFamily His keyed with(H key message).length = key.length,secondPreimageToCollisionFinder adversary rturns a second-preimage finder forCollisionResistantToOneWay.keyDigest Hat length3 * n + rinto aCollisionFinderforHat parametern(isPPT_secondPreimageToCollisionFinder), with exact zero-loss boundsuccProbability_secondPreimageGame_keyDigest_leand asymptotic implicationHashFamily.secondPreimageResistant_keyDigest. - One-wayness does not imply second-preimage resistance ([BS23], Section 8.11.1,
p. 337):
ignoreHeadBit f w = f w.tailpreservesOneWayOn(OneWayOn.ignoreHeadBit, viaignoreHeadBitInverterandisPPT_ignoreHeadBitInverter) while flipping the head bit (flipHeadBit) winssecondPreimageGameOnwith probability1(not_secondPreimageResistantOn_ignoreHeadBit). - Second-preimage resistance does not imply one-wayness at bounded compression
([BS23], Exercise 8.23(c), p. 353, on bit strings):
plantEasyBranch k Houtputstrue :: w.drop kwhenw.take k == List.replicate k falseandfalse :: H wotherwise (with output lengths tracked bylength_plantEasyBranch), preservingSecondPreimageResistantOn(and thusSecondPreimageResistant) viaSecondPreimageResistantOn.plantEasyBranchwhile failingOneWayOnon every domain containing then-bit words with inversion probability at least(1 / 2) ^ k(not_oneWayOn_plantEasyBranch, viaplantEasyBranchInverterandisPPT_plantEasyBranchInverter).
Main definitions #
Cslib.Crypto.inverterToSecondPreimage: wrap anInverterinto aSecondPreimageFinder.Cslib.Crypto.secondPreimageToCollisionFinder: reduction fromsecondPreimageGame (keyDigest H)tocollisionGame H.Cslib.Crypto.ignoreHeadBit,Cslib.Crypto.ignoreHeadBitInverter: the Section 8.11.1 separation construction and its reductions (re-exportingCslib.Crypto.flipHeadBitfromCslibFrontier.Crypto.Computational.FlipHeadBit).Cslib.Crypto.plantEasyBranch,Cslib.Crypto.plantEasyBranchInverter: the bit-string form of Exercise 8.23(c) and its inverter.
Main results #
Cslib.Crypto.isPPT_inverterToSecondPreimage,Cslib.Crypto.succProbability_inversionGameOn_le_secondPreimageGameOn_add,Cslib.Crypto.SecondPreimageResistantOn.oneWayOn_of_outputLength.Cslib.Crypto.isPPT_secondPreimageToCollisionFinder,Cslib.Crypto.succProbability_secondPreimageGame_keyDigest_le,Cslib.Crypto.HashFamily.secondPreimageResistant_keyDigest.Cslib.Crypto.not_secondPreimageResistantOn_ignoreHeadBit,Cslib.Crypto.isPPT_ignoreHeadBitInverter,Cslib.Crypto.OneWayOn.ignoreHeadBit.Cslib.Crypto.length_plantEasyBranch,Cslib.Crypto.SecondPreimageResistantOn.plantEasyBranch,Cslib.Crypto.isPPT_plantEasyBranchInverter,Cslib.Crypto.not_oneWayOn_plantEasyBranch.
References #
- D. Boneh and V. Shoup, A Graduate Course in Applied Cryptography, Section 8.11.1 (Definition 8.6, p. 336; equation (8.17), p. 337) and Exercise 8.23(b)–(d) (p. 353).
Second-preimage resistance implies one-wayness under super-polynomial compression #
Evaluating f and running a strict PPT inverter is uniformly strict PPT.
Reduction from second-preimage search to inversion on a domain: when f maps n-bit
inputs to d-bit digests, an inverter adversary at length n succeeds within valid with
probability at most SPRadvOn[B, f] + 2 ^ d / 2 ^ n, for the finder B that asks adversary to
invert f m. A winning answer x' is either a second preimage of the challenge m, which is a win
for B on the same domain, or m itself, which adversary guesses from f m with probability at
most 2 ^ d / 2 ^ n. This is the factor-one form of [BS23], Exercise 8.23(b), (8.22),
p. 353, whose generic form is succProbability_inversionExperiment_uniform_le_add_card_div.
Equation (8.17), second implication, and Exercise 8.23(b) ([BS23], pp. 337, 353):
a function that is second-preimage resistant on valid (Definition 8.6, p. 336), whose n-bit
inputs have outLen n-bit digests with 2 ^ outLen n / 2 ^ n negligible (a super-polynomial
compression factor s(n) = 2 ^ n / 2 ^ outLen n), is one-way on valid (Definition 8.6). With
valid n w = decide (w.length = n) both are Definition 8.6 on M = {0,1}ⁿ and
T = {0,1}^(outLen n).
Collision resistance implies second-preimage resistance (Exercise 8.23(d) and (8.17)) #
Turn a second-preimage finder for CollisionResistantToOneWay.keyDigest H at input length
3 * n + r into a CollisionFinder for H at security parameter n by sampling a random
(2 * n + r)-bit message x and pairing x with the message part of the finder's answer.
Sampling a (2 * n + r)-bit message, running adversary (3 * n + r), and slicing the answer
is uniformly strict PPT.
A second preimage candidate ≠ key ++ message of key ++ message under keyDigest H has the
same key key and a colliding message part candidate.drop (candidate.length / 3) ≠ message.
Exercise 8.23(d), concrete bound for keyDigest H: finding a second preimage of
keyDigest H at length 3 * n + r with r < 3 succeeds at most as often as
secondPreimageToCollisionFinder adversary r finds a collision for H at parameter n, with no
guessing loss.
Equation (8.17), first implication, and Exercise 8.23(d) ([BS23], pp. 337, 353):
for a keyed collision-resistant hash family H with (H key message).length = key.length,
CollisionResistantToOneWay.keyDigest H replaces the book's unkeyed H and is second-preimage
resistant (and hence also SecondPreimageResistantOn (keyDigest H) valid for any valid via
SecondPreimageResistantOn.mono).
Separations: one-way does not imply second-preimage resistant, and Exercise 8.23(c) #
Section 8.11.1 separation, negative half ([BS23], p. 337) for
SecondPreimageResistantOn: for every f and every validity predicate valid admitting
flipHeadBit on sufficiently large n-bit inputs (including fun n w => decide (w.length = n)),
ignoreHeadBit f is not second-preimage resistant on valid.
Inverter for f at length n built from an inverter for ignoreHeadBit f at length n + 1:
run adversary (n + 1) and take the tail of its candidate preimage.
Inverting ignoreHeadBit f within valid at length n + 1 succeeds at most as often as
ignoreHeadBitInverter adversary inverts f within valid at length n, when dropping the head
of a valid answer at length n + 1 leaves a valid answer at length n.
Section 8.11.1 separation, positive half ([BS23], p. 337): if f is one-way on
valid (Definition 8.6, p. 336), then ignoreHeadBit f, the bit-string form of
h'(m, b) := h(m), is one-way on valid, provided that dropping the head of a valid answer at
length n + 1 leaves a valid answer at length n. With valid n w = decide (w.length = n),
ignoreHeadBit f at length n + 1 is h' on {0,1} × {0,1}ⁿ for h = f on {0,1}ⁿ. It fails
second-preimage resistance by not_secondPreimageResistantOn_ignoreHeadBit.
The bit-string form of Exercise 8.23(c) ([BS23], p. 353): when the first k bits of
w are all false (probability 1 / 2 ^ k at length n ≥ k, so 1 / (2 * s) with
2 * s = 2 ^ k), output true :: w.drop k; otherwise output false :: H w.
Output length of plantEasyBranch k H w: when the first k bits of w are false, it has
length w.length - k + 1; otherwise (H w).length + 1. Thus if H compresses n-bit inputs
by k bits for n ≥ k, plantEasyBranch k H compresses n-bit inputs by k - 1 bits.
Every second preimage under plantEasyBranch k H is a second preimage under H: any word
whose first k bits are false is uniquely determined by plantEasyBranch k H w.
For every second-preimage finder adversary, its valid-domain success probability against
plantEasyBranch k H is at most its valid-domain success probability against H.
Exercise 8.23(c) on bit strings, positive half ([BS23], p. 353): if H is
second-preimage resistant on valid, then plantEasyBranch k H is also second-preimage resistant
on valid (and in particular SecondPreimageResistant when H is).
Inverter for plantEasyBranch k H: prepend k false bits to the tail of the digest.
Exercise 8.23(c) on bit strings, negative half ([BS23], p. 353): for every k
and H, plantEasyBranch k H is not one-way (Definition 8.6, p. 336) on any domain valid that
contains the n-bit words: at length n ≥ k, plantEasyBranchInverter k returns the sampled
n-bit input with probability at least (1 / 2) ^ k.