Brute force and the birthday attack as polynomial-time collision finders #
The generic collision attacks of [BS23], §8.3 (printed pp. 293–295), brute force and
Algorithm BirthdayAttack, as word-level CollisionFinders with IsPPT certificates, and the
refutations of CollisionResistantOn they give.
CslibFrontier.Crypto.Computational.CollisionResistant.Birthday instead treats the birthday finder
as an oracle program and counts its oracle calls; here each finder is a probabilistic
polynomial-time program that evaluates the keyed hash itself.
collidingPairList? h ms is the first pair of different messages of ms with equal digests. Brute
force (bruteForceCollisionFinder) searches a fixed list of more than 2 ^ ℓ(n) distinct valid
messages and always succeeds; the birthday finder (birthdayCollisionFinder) with the book's
⌈2 √N⌉ + 1 samples, N = 2 ^ ℓ(n), succeeds with probability at least 1/2 when
100 N ≤ 2 ^ msgLen(n) and valid accepts every msgLen(n)-bit message (Lemma 8.2).
Every refutation needs 2 ^ ℓ(n) to be polynomial in n (the birthday statements and
not_collisionResistant_of_two_pow_polyTime assume that it is computable in unary in polynomial
time), so they cover constant and logarithmic digest lengths, where brute force alone refutes
collision resistance; the birthday refutation adds a certified finder with success 1/2 on
msgLen(n)-bit messages. Nothing compares the √N samples with the N + 1 messages of brute force
in machine time. CslibFrontier.Crypto.Computational.CollisionResistant.BruteForce counts the
2 ^ ℓ + 1 hash evaluations of brute force as oracle calls, as Birthday.lean does for the
birthday finder.
Differences from [BS23] #
- The statements are asymptotic:
n-bit keys,ℓ(n)-bit digests,msgLen(n)-bit messages, and the domain predicatevalidmust accept the messages searched (hvalid).|M| ≥ 100 Nbecomes100 * 2 ^ ℓ n ≤ 2 ^ msgLen n. - Steps 4 and 5 of Algorithm BirthdayAttack test for equal digests, then for different messages;
collidingPairList?, likecollidingPair?, tests both at once, so the finder succeeds on the event of Lemma 8.2. When it finds nothing, its output([], [])is not a collision. - Brute force searches any polynomial-time list of more than
2 ^ ℓ(n)distinct messages;not_collisionResistant_of_two_pow_polyTimeuses the book's2 ^ ℓ(n) + 1.
Main definitions #
Cslib.Crypto.collidingPairList?,Cslib.Crypto.bruteForceCollisionFinder,Cslib.Crypto.birthdayCollisionFinder.
Main results #
Cslib.Crypto.isSome_collidingPairList?_of_two_pow_lt: the pigeonhole step of brute force.Cslib.Crypto.succProbability_bruteForceCollisionFinder,Cslib.Crypto.half_le_succProbability_birthdayCollisionFinder: success1and≥ 1/2.Cslib.Crypto.not_collisionResistantOn_of_bruteForce,Cslib.Crypto.not_collisionResistantOn_of_birthday: the refutations.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, §8.3 (printed pp. 293–295).
The first pair of different messages of ms with equal digests under h, in the order of the
pairs of ms.map fun m => (m, h m) with itself, so that each digest is computed once. This is the
list form of collidingPair?.
An output some (a, b) of collidingPairList? is a collision among the messages.
collidingPairList? finds a pair exactly when the messages contain a collision.
Brute force ([BS23], §8.3, printed pp. 293–294): among more than 2 ^ ℓ
distinct messages with ℓ-bit digests, two have the same digest.
Searching computed messages for a collision of a keyed polynomial-time hash.
The birthday finder is PPT for a polynomial-time hash, message length and sample count.
Brute force is PPT when the hash and the list of messages are polynomial time.
The birthday finder with the book's count ⌈2 √N⌉ + 1, N = 2 ^ ℓ(n), is PPT when msgLen(n)
and 2 ^ ℓ(n) are computable in unary in polynomial time.
Brute force succeeds ([BS23], §8.3, printed pp. 293–294): searching more than
2 ^ ℓ(n) distinct valid messages with ℓ(n)-bit digests finds a collision with certainty.
Lemma 8.2 for the birthday finder ([BS23], §8.3, printed p. 294): with
⌈2 √N⌉ + 1 uniform msgLen(n)-bit messages, N = 2 ^ ℓ(n) and 100 N ≤ 2 ^ msgLen(n), the
finder outputs a collision with probability at least 1/2 when valid accepts every
msgLen(n)-bit message.
The birthday attack ([BS23], §8.3, Lemma 8.2): a polynomial-time keyed hash with
ℓ(n)-bit digests on msgLen(n)-bit messages, 100 * 2 ^ ℓ(n) ≤ 2 ^ msgLen(n), is not collision
resistant on a domain valid that accepts every msgLen(n)-bit message, when msgLen(n) and
2 ^ ℓ(n) are computable in unary in polynomial time.
Brute force ([BS23], §8.3, printed pp. 293–294): a polynomial-time keyed hash with
ℓ(n)-bit digests is not collision resistant when a polynomial-time list of more than 2 ^ ℓ(n)
distinct valid messages exists.
A polynomial-time keyed hash with ℓ(n)-bit digests is not collision resistant when
2 ^ ℓ(n) is computable in unary in polynomial time: brute force on 2 ^ ℓ(n) + 1 messages.