Joux multicollisions of Merkle–Damgård chains, with their cost #
Joux's attack ([BS23], §8.4.1, printed pp. 298–299) finds many messages with one digest
for an iterated hash at little more than the cost of one collision. If b pairs of different
blocks (m_i, m_i') satisfy h(t_i, m_i) = h(t_i, m_i'), where t_{i+1} = h(t_i, m_i), then each
of the 2 ^ b messages that take one block from each pair reaches the same chaining value.
This module proves that structural fact for any iterated function (IsCollisionChain,
IsCollisionChain.isMulticollision), and builds and analyses oracle programs that find such
chains with the birthday finder of CslibFrontier.Crypto.Computational.CollisionResistant.Birthday.
Each program has a bound on its oracle calls that holds on every path, and a lower bound on its
success probability that holds for every compression function meeting a length condition.
jouxFinderruns the stages against any step program. It shares a budget offbirthday attempts among thebstages: an attempt that finds a collision records it and moves on from the chaining value it reaches; an attempt that finds none is repeated from the same value; when the budget is spent the program returnsnone. It makes at mostf * (s * c)oracle calls when each step costsc(isQueryBounded_jouxFinder), and returns a collision chain of lengthbexcept with probability2 ^ b * ((1 + ε) / 2) ^ f / 2, whereεbounds the probability that one attempt finds no collision (jouxFinder_success).merkleDamgardJouxFinderis the book's setting: a chainmerkleDamgardChainwithℓ-bit blocks andn-bit chaining values. Withℓ ≥ n + 7,s = ⌈2 √(2 ^ n)⌉ + 1samples per attempt and3 battempts, it makes at most3 b scompression calls, and with probability at least1/2it outputsbpairs such that, for every common list of blockstail, their2 ^ bselections, each followed bytail, are a2 ^ b-collision (isQueryBounded_merkleDamgardJouxFinder,merkleDamgardJouxFinder_success_half).merkleDamgardBitJouxFinderdoes the same for the library'smerkleDamgard, which spends one compression call per message bit. It treatsgconsecutive bits as one candidate, so its count1 + 3 b s gcarries a factorg ≥ n + 7that the book's count does not (isQueryBounded_merkleDamgardBitJouxFinder,merkleDamgardBitJouxFinder_success_half).
These are steps toward §8.4.1, not the cited result: the book finds a 2 ^ b-collision "in time
O(b 2 ^ (n/2))" and uses it to find a collision of H₁(M) ‖ H₂(M) in time O(n 2 ^ (n/2)),
whereas the certificates here count compression evaluations, not running time, and the
concatenated-hash attack is not formalized (#5293).
The cost measure. The certificates are ProbOracleComp.IsQueryBounded, with the compression
function as the oracle. They count evaluations of the compression function on every path,
whatever the samples and the replies; that is the cost measure of §8.3. They are not running-time
bounds: sampling, the search for a colliding pair and the bookkeeping are not counted, and no
machine model is involved. They are worst-case counts, not expected costs. The programs reach the
compression function only through the oracle, and the success theorems run them against
fun x => pure (h k x), so each certificate and its success theorem are about the same program.
Differences from [BS23] #
- Cost. The book uses the birthday attack
log₂ stimes, spending2 ^ (n/2)on each, and concludes that it found a2 ^ b-collision "in timeO(b 2 ^ (n/2))". It states no success probability and does not say what happens when an attack finds no collision. Here a budget offattempts serves thebstages; withf = 3 band the sample count of Lemma 8.2 the finder makes at most3 b (⌈2 √(2 ^ n)⌉ + 1)compression evaluations and succeeds with probability at least1/2. The constant3and the probability1/2are this library's choices;merkleDamgardJouxFinder_successhas the general trade-off. - Cost measure. §8.4.1 says "time". The certificates count compression evaluations only.
- Block length. §8.4.1 states no condition on the blocks. Lemma 8.2, which it applies to
h(t, ·), needs|Y| ≥ 100 |X|; the statements here assumeℓ ≥ n + 7, since2 ^ 7 ≥ 100. Without such a condition the claim is false: a compression function that is injective in the block has no block collision. s-collision. Ans-collision is aFinsetofsmessages with one digest (IsMulticollision), so the messages are distinct, as [BS23], Exercise 8.7 (printed p. 349) makes explicit; §8.4.1 says "a set of messages". The programs output thebpairs, not the2 ^ bmessages.- Blocks. Blocks are bit strings with a length hypothesis on
h, in place ofh : X × Y → X. The existing development inCslibFrontier.Crypto.Computational.MerkleDamgardtakes blocks as long as chaining values;merkleDamgardChainitself does not, and the statements formerkleDamgardJouxFinderare about it with longer blocks.
Main definitions #
Cslib.Crypto.IsCollisionChain:bpairs of different messages, each colliding at the value reached through the pairs before it.Cslib.Crypto.jouxMessage: the message that takes one message from each pair.Cslib.Crypto.IsMulticollision:sdistinct points with one value.Cslib.Crypto.jouxFinder,Cslib.Crypto.merkleDamgardJouxFinder,Cslib.Crypto.merkleDamgardBitJouxFinder: the finders.Cslib.Crypto.multicollisionOutputs,Cslib.Crypto.bitMulticollisionOutputs: the success events of the last two, unfolded byCslib.Crypto.mem_multicollisionOutputsandCslib.Crypto.mem_bitMulticollisionOutputs.
Main results #
Cslib.Crypto.IsCollisionChain.isMulticollision: a collision chain of lengthbgives a2 ^ b-collision of the iterated function, also after a common suffix.Cslib.Crypto.isMulticollision_merkleDamgardChain,Cslib.Crypto.isMulticollision_merkleDamgard_of_chain: the same formerkleDamgardChainand formerkleDamgard.Cslib.Crypto.isQueryBounded_jouxFinder,Cslib.Crypto.jouxFinder_success: cost and success of the generic finder.Cslib.Crypto.isQueryBounded_merkleDamgardJouxFinder,Cslib.Crypto.merkleDamgardJouxFinder_success,Cslib.Crypto.merkleDamgardJouxFinder_success_half: Joux's attack onmerkleDamgardChain, counted in compression evaluations (a step toward §8.4.1).Cslib.Crypto.isQueryBounded_merkleDamgardBitJouxFinder,Cslib.Crypto.merkleDamgardBitJouxFinder_success,Cslib.Crypto.merkleDamgardBitJouxFinder_success_half: the same formerkleDamgard.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, §8.4.1 (printed pp. 298–299); §8.3, Lemma 8.2 (printed p. 294); Exercise 8.7 (printed p. 349).
Collision chains of an iterated function #
The two messages of each pair of a collision chain differ.
Joux's observation ([BS23], §8.4.1, printed p. 299): every choice of one message from each pair of a collision chain reaches the same value as the first messages.
Different selections from a collision chain are different messages.
Joux multicollisions ([BS23], §8.4.1, printed p. 299): a collision chain of
length b gives a 2 ^ b-collision of the iterated function, also after any common suffix.
Two different valid members of a multicollision of H key are a collision in the sense of the
collision-resistance game (isCollision).
The Joux finder for any step program #
Joux's finder with a budget of f birthday attempts for b stages, from the chaining value
t. Each attempt runs birthdayFinder with the step program stage t from the current value. A
collision is recorded and the search goes on from the value it reaches; an attempt that finds no
collision is repeated from the same value. Returns the b pairs, or none when the budget runs
out first.
Cost of the Joux finder. f attempts of s steps of at most c oracle calls each make
at most f * (s * c) oracle calls on every path, whatever the number of stages. This counts oracle
calls only; it is not a running time.
Success probability of the Joux finder. Run against a deterministic oracle O under which
the step program stage t m returns step t m, from a value t in a finite set D closed under
step: if one birthday attempt with s uniform messages finds no collision with probability at
most ε (in the form that birthdayFinder_success proves, with |D| values), then f attempts
complete the b stages, returning a collision chain of length b, except with probability at
most 2 ^ b * ((1 + ε) / 2) ^ f / 2.
Merkle–Damgård chains with ℓ-bit blocks #
Joux's finder for a Merkle–Damgård chain with ℓ-bit blocks from iv, against the
compression function as an oracle: at most f attempts of s uniform blocks for b stages, one
compression call per block.
Cost of Joux's attack on a chain. merkleDamgardJouxFinder ℓ s f b iv makes at most
f * s evaluations of the compression function on every path. This counts oracle calls only; it
is not a running time.
A collision chain of ℓ-bit blocks gives a 2 ^ b-collision of the chain from iv, after
any common suffix of blocks ([BS23], §8.4.1, printed p. 299).
The outputs of merkleDamgardJouxFinder that are b pairs whose 2 ^ b selections, each
followed by any common list of blocks tail, are a 2 ^ b-collision of the chain from iv. One
output serves every tail. mem_multicollisionOutputs unfolds membership.
Membership in multicollisionOutputs: b pairs whose selections, each followed by any common
list of blocks, are a 2 ^ b-collision of the chain from iv.
Joux's attack on a chain, with its cost. Let h k map n + ℓ-bit inputs to n-bit
outputs and let iv have n bits. With at most f * s compression evaluations
(isQueryBounded_merkleDamgardJouxFinder), merkleDamgardJouxFinder outputs b pairs such that,
for every common list of blocks tail, their 2 ^ b selections, each followed by tail, are a
2 ^ b-collision of the chain, except with probability at most 2 ^ b * ((1 + ε) / 2) ^ f / 2,
where ε bounds exp (-s (s - 1) / 2 ^ (n + 1)) + C(s, 2) / 2 ^ ℓ, the bound of Lemma 8.2 on the
probability that one attempt finds no collision.
Joux's attack on a chain with O(b 2 ^ (n/2)) compression evaluations, a step toward
[BS23], §8.4.1 (printed p. 299), not the cited result: the book finds a
2 ^ b-collision "in time O(b 2 ^ (n/2))", whereas the count here is of compression evaluations
only, not a running time (#5293). Let h k map n + ℓ-bit inputs to n-bit outputs, let iv
have n bits, and let blocks be at least seven bits longer than chaining values (n + 7 ≤ ℓ).
With the sample count s = ⌈2 √(2 ^ n)⌉ + 1 of Lemma 8.2 per attempt and a budget of 3 b
attempts, merkleDamgardJouxFinder makes at most 3 b s compression evaluations
(isQueryBounded_merkleDamgardJouxFinder), and with probability at least 1/2 it outputs b
pairs such that, for every common list of blocks tail, their 2 ^ b selections, each followed by
tail, are a 2 ^ b-collision. The book states no success probability.
The library's one-bit-per-block merkleDamgard #
Against h k, absorbBits n t m continues the chain from t over the data blocks of m.
absorbBits n t m makes at most m.length compression calls.
A collision chain of g-bit groups, from the value after the marker block, gives a
2 ^ b-collision of merkleDamgard h k among messages of b * g bits.
Joux's finder for the library's merkleDamgard with n-bit digests: one compression call for
the marker block, then at most f attempts of s uniform g-bit groups for b stages, g
compression calls per group.
Cost of Joux's attack on merkleDamgard. merkleDamgardBitJouxFinder n g s f b makes at
most 1 + f * (s * g) evaluations of the compression function on every path. This counts oracle
calls only; it is not a running time.
The outputs of merkleDamgardBitJouxFinder that are b pairs whose 2 ^ b selections are a
2 ^ b-collision of merkleDamgard h k. mem_bitMulticollisionOutputs unfolds membership.
Membership in bitMulticollisionOutputs: b pairs of g-bit groups whose selections are a
2 ^ b-collision of merkleDamgard h k.
Joux's attack on merkleDamgard, with its cost. Let h k map 2 n-bit inputs to n-bit
outputs, where n = k.length. With at most 1 + f * (s * g) compression evaluations
(isQueryBounded_merkleDamgardBitJouxFinder), merkleDamgardBitJouxFinder outputs b pairs of
g-bit groups whose 2 ^ b selections are a 2 ^ b-collision of merkleDamgard h k except with
probability at most 2 ^ b * ((1 + ε) / 2) ^ f / 2, where ε bounds
exp (-s (s - 1) / 2 ^ (n + 1)) + C(s, 2) / 2 ^ g.
Joux's attack on merkleDamgard with the sample count of Lemma 8.2, a step after
[BS23], §8.4.1 (printed p. 299), not the cited result: it attacks the library's
one-bit-per-block merkleDamgard rather than the book's chain, and it counts compression
evaluations, not running time (#5293). Let h k map 2 n-bit inputs to n-bit outputs, where
n = k.length, and let groups have g bits, at least seven more than a digest (n + 7 ≤ g).
With s = ⌈2 √(2 ^ n)⌉ + 1 samples per attempt and a budget of 3 b attempts,
merkleDamgardBitJouxFinder makes at most 1 + 3 b s g compression evaluations
(isQueryBounded_merkleDamgardBitJouxFinder) and outputs a 2 ^ b-collision of
merkleDamgard h k with probability at least 1/2. The factor g ≥ n + 7 is the price of one
compression call per message bit, so this count is not the book's O(b 2 ^ (n/2)).