Length-strengthened Merkle–Damgård hash and Theorem 8.3 #
For a compression function h, lengthStrengthenedMD h k msg hashes msg by iterating
merkleDamgardChain over the padded blocks mdLengthBlocks k.length msg starting from the
all-zero k.length-bit initialization vector ([BS23], Section 8.4, pp. 295–298).
Theorem 8.3 ([BS23], p. 297; proof ending on p. 298) states that H_MD is collision
resistant when h is, with CRadv[A, H_MD] = CRadv[B, h] for a wrapper B around A.
lengthStrengthenedWrapper is that B: it succeeds with adversary's exact probability whenever
every valid message satisfies mdLengthBlockCount n m < 2 ^ (n / 2), the condition under which
the padding is suffix-free. Since every uniform strict PPT adversary only produces messages of
polynomially bounded length, every CompressionFamily h yields unrestricted
CollisionResistant (lengthStrengthenedMD h) and HashFamily (lengthStrengthenedMD h).
Main definitions #
Cslib.Crypto.lengthStrengthenedMD: length-strengthened Merkle–Damgård hash built frommerkleDamgardChain, the all-zero IV, andmdLengthBlocks.Cslib.Crypto.lengthStrengthenedWrapper: explicit Theorem 8.3 reduction adversary mapping validlengthStrengthenedMDcollisions viaextractChainCollisionto2n-bit collisions forh, and returning([], [])otherwise.
Main results #
Cslib.Crypto.length_lengthStrengthenedMD: length preservation oflengthStrengthenedMD h.Cslib.Crypto.computableInPolyTime_lengthStrengthenedMD: deterministic polynomial-time certificate forlengthStrengthenedMD h.Cslib.Crypto.isPPT_lengthStrengthenedWrapper: uniform strict PPT certificate forlengthStrengthenedWrapper.Cslib.Crypto.succProbability_collisionGame_lengthStrengthenedMD_eq: concrete advantage equality forlengthStrengthenedWrapperwhenever every valid message satisfiesmdLengthBlockCount n m < 2 ^ (n / 2).Cslib.Crypto.CompressionFamily.collisionResistant_lengthStrengthenedMD: unrestricted collision resistance oflengthStrengthenedMD hfor anyCompressionFamily h.Cslib.Crypto.CompressionFamily.hashFamily_lengthStrengthenedMD:HashFamilyinstance forlengthStrengthenedMD hfrom anyCompressionFamily h.
Differences from Boneh–Shoup §8.4 #
- (a) Parameterization (
ℓ = n,IV = 0^n, single2n-bit compression input): [BS23], Section 8.4 (pp. 295–296) separates chaining lengthnfrom block lengthℓ, uses an arbitrary fixedIV ∈ {0, 1}^n, and writes two-argument compressionh(tᵢ₋₁, mᵢ); hereℓ = n = k.length,IVis fixed toList.replicate k.length false, andh k (t ‖ m)takes a single2n-bitList BoolmatchingCompressionFamily. - (b) Domain bound as a predicate rather than
{0, 1}^{≤ L}: SeeCslibFrontier/Crypto/Computational/MerkleDamgard/LengthPadding.leanfor the padding differences (ℓ = n,(n / 2)-bit block-count field, counting padded blocks, and truncation whenmdLengthBlockCount n msg ≥ 2 ^ (n / 2)). Where Fig. 8.5 (pp. 296–297) restricts the message type to a bounded domain{0, 1}^{≤ L},succProbability_collisionGame_lengthStrengthenedMD_eqtakes the explicit hypothesis∀ m, valid n m = true → mdLengthBlockCount n m < 2 ^ (n / 2), whileCollisionResistantandHashFamilyrecover suffix-freeness asymptotically because strict PPT adversaries output messages of polynomially bounded length. - (c) Keyed uniform setting: the hash and compression function are keyed by a uniform
k ← {0, 1}^nat each security parametern, matchingCollisionResistantandCompressionFamilyrather than a fixed/implicit key with finite message spaces. - (d) Checked wrapper giving exact
=: the book'sBrunsA"to obtain two distinct messages" that collide (p. 297), givingCRadv[A, H_MD] = CRadv[B, h], without specifying whatBreturns otherwise. HerelengthStrengthenedWrapperchecksisCollision (lengthStrengthenedMD h) validand returns([], [])on failure, so it wins on the exact same event asadversary(whereassuccProbability_collisionGame_le_of_extractgives≤for an unchecked extractor). Efficiency usesComputableInPolyTimeand strict uniformIsPPT.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 8.4 (pp. 295–298).
Length-strengthened Merkle–Damgård hash: iterates merkleDamgardChain over the padded blocks
mdLengthBlocks k.length msg starting from the all-zero k.length-bit IV.
This instantiates [BS23], Section 8.4 (pp. 295–297) with block length k.length, fixed
IV = List.replicate k.length false, and the (k.length / 2)-bit block-count encoding from
mdLengthBlocks.
When h k maps 2 * k.length-bit inputs to k.length-bit digests,
lengthStrengthenedMD h k msg outputs a k.length-bit digest.
Deterministic polynomial-time evaluation of lengthStrengthenedMD h from deterministic
polynomial-time evaluation and length preservation of h.
Reduction adversary for [BS23], Theorem 8.3 (p. 297): runs adversary, checks
whether the output pair (m₁, m₂) is a valid collision for lengthStrengthenedMD h under
valid, and if so runs extractChainCollision on mdLengthBlocks k.length m₁ and
mdLengthBlocks k.length m₂ to extract a 2n-bit collision for h, returning ([], []) when
the check fails.
Uniform strict PPT certificate for lengthStrengthenedWrapper.
Boneh–Shoup Theorem 8.3 (concrete equality): when h preserves n-bit output lengths and
every valid n-accepted message satisfies mdLengthBlockCount n m < 2 ^ (n / 2), adversary
succeeds against lengthStrengthenedMD h on valid with the exact same probability that
lengthStrengthenedWrapper h valid adversary succeeds against h on validCompressionInput.
Boneh–Shoup Theorem 8.3 (asymptotic): any 2n → n collision-resistant compression family
h yields an unrestricted collision-resistant hash lengthStrengthenedMD h on all bit strings.
Every 2n → n collision-resistant compression family h induces a collision-resistant
hash family HashFamily (lengthStrengthenedMD h) on arbitrary bit strings.