The brute-force collision finder and its 2 ^ ℓ + 1 hash evaluations #
bruteForceFinder digest ms computes the digest of each of s fixed messages ms : Fin s → M with
the oracle program digest and returns the first pair of different messages with equal digests
([BS23], §8.3, printed pp. 293–294). Like birthdayFinder in
CslibFrontier.Crypto.Computational.CollisionResistant.Birthday, it reaches the function being
attacked only through its oracle, so a bound on its oracle calls bounds evaluations of that
function; CslibFrontier.Crypto.Computational.CollisionResistant.GenericAttacks instead gives the
polynomial-time Turing-machine refutation when 2 ^ ℓ(n) is polynomial in n.
- Cost. When each
digest (ms i)makes at mostcoracle calls,bruteForceFinder digest msmakes at mosts * con every path (isQueryBounded_bruteForceFinder). Specializing to single oracle queries on the first2 ^ ℓ + 1binary words of lengthℓ + 1(BitString.lowBits),bruteForceHashFinder ℓmakes at most2 ^ ℓ + 1hash evaluations, for every digest lengthℓ : ℕ(isQueryBounded_bruteForceHashFinder). Generating the messages and comparing pairs of digests incollidingPair?are not counted: this is an oracle-call count, not a running time. - Success. By pigeonhole (
isSome_collidingPair?_of_card_lt), if thesmessages are distinct and their digests underflie in a finite setDwithD.card < s,bruteForceFinderrun against a deterministic oracle realizingfreturns a collision incollisionOutputs fwith probability1(bruteForceFinder_success). Forℓ-bit digests (D = BitString.wordsOfLength ℓ, of size2 ^ ℓ < 2 ^ ℓ + 1), any2 ^ ℓ + 1distinct messages give a collision with probability1(bruteForceFinder_two_pow_succ_success), andbruteForceHashFinder ℓfinds one for every hash mapping(ℓ + 1)-bit words toℓ-bit digests (bruteForceHashFinder_success). Whateversandms, every output other thannoneis a collision (bruteForceFinder_sound).
Differences from [BS23] #
- The book states brute-force collision search for a hash
Houtputtingℓ-bit digests ("for some smallℓ", illustratingℓ = 16and2 ^ 16 + 1 = 65537evaluations) over a message space with at least2 ^ ℓ + 1messages. HerebruteForceFindertakes anysmessages and any oracle programdigestover any finite target setDwithD.card < s; the2 ^ ℓ + 1theorems hold for everyℓ : ℕ, withbruteForceHashFinder ℓquerying the first2 ^ ℓ + 1(ℓ + 1)-bit words (2 ^ ℓ + 1 ≤ 2 ^ (ℓ + 1)). - The book counts evaluations of
H. HereisQueryBounded_bruteForceFinderandisQueryBounded_bruteForceHashFinderbound external oracle calls (ProbOracleComp.IsQueryBounded) on every path; message generation and searching the2 ^ ℓ + 1digests are not counted.
Main definitions #
Cslib.Crypto.collidingPair?: the first pair of different messages with equal digests.Cslib.Crypto.collisionOutputs: the outputs that are collisions of a function.Cslib.Crypto.bruteForceFinder: the brute-force collision finder as an oracle program.Cslib.Crypto.bruteForceHashFinder: single-query brute-force search on2 ^ ℓ + 1binary words of lengthℓ + 1.
Main results #
Cslib.Crypto.isSome_collidingPair?_of_card_lt: pigeonhole collision guarantee forcollidingPair?.Cslib.Crypto.isQueryBounded_bruteForceFinder,Cslib.Crypto.isQueryBounded_bruteForceHashFinder: worst-case oracle-call boundss * cand2 ^ ℓ + 1.Cslib.Crypto.eval_run_bruteForceFinder: deterministic run characterization.Cslib.Crypto.bruteForceFinder_sound: every output other thannoneis a collision.Cslib.Crypto.bruteForceFinder_success,Cslib.Crypto.bruteForceFinder_two_pow_succ_success,Cslib.Crypto.bruteForceHashFinder_success: probability-1collision finding ([BS23], §8.3, printed pp. 293–294).
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, §8.3 (printed pp. 293–294).
The first pair of positions (in lexicographic order) whose digests agree and whose messages differ, returned as the two messages and their common digest.
An output some (m, m', d) of collidingPair? is two different messages that occur among
ms with digest d.
collidingPair? finds a pair exactly when two positions have equal digests and different
messages.
Any non-none output of collidingPair? ms (fun i => f (ms i)) is a collision of f in
collisionOutputs f.
Pigeonhole for collidingPair?: among s distinct messages whose digests all lie in a
finite set D of cardinality strictly less than s, two positions have equal digests and
different messages.
The brute-force collision finder ([BS23], §8.3, printed pp. 293–294): compute the
digest of each of s fixed messages ms with the oracle program digest, and return the first
pair of different messages with equal digests, together with their common digest.
Cost of the brute-force finder. When each digest (ms i) makes at most c oracle calls,
the finder makes at most s * c on every path. Message generation and the search among the s
digests are not counted: this is a count of oracle calls, not a running time.
Against a deterministic oracle O under which digest (ms i) returns f (ms i), the finder
deterministically returns collidingPair? ms fun i => f (ms i).
The finder never returns a wrong pair: against a deterministic oracle under which
digest (ms i) returns f (ms i), every output other than none is a collision of f.
Success of the brute-force finder. Against a deterministic oracle under which
digest (ms i) returns f (ms i), if ms consists of s distinct messages whose digests all lie
in a finite set D with D.card < s, the finder returns a collision of f with probability
1.
Brute force on 2 ^ ℓ + 1 distinct messages with ℓ-bit digests
([BS23], §8.3, printed pp. 293–294): for every digest length ℓ : ℕ, evaluating any
2 ^ ℓ + 1 distinct messages whose digests have length ℓ finds a collision of f with
probability 1. With isQueryBounded_bruteForceFinder, this uses at most (2 ^ ℓ + 1) * c oracle
calls when each digest makes at most c.
Single-query brute-force collision search for ℓ-bit digests ([BS23], §8.3, printed
pp. 293–294): query the hash oracle once on each of the first 2 ^ ℓ + 1 binary words of length
ℓ + 1 (BitString.lowBits (ℓ + 1)) and return the first colliding pair and its digest.
Cost of bruteForceHashFinder ([BS23], §8.3, printed pp. 293–294): for every
digest length ℓ : ℕ, bruteForceHashFinder ℓ makes at most 2 ^ ℓ + 1 hash queries on every
path. Generating the (ℓ + 1)-bit messages and comparing digests are not counted.
Success of bruteForceHashFinder ([BS23], §8.3, printed pp. 293–294): for every
digest length ℓ : ℕ and every hash H : List Bool → List Bool mapping (ℓ + 1)-bit words to
ℓ-bit digests, bruteForceHashFinder ℓ returns a collision of H with probability 1 using at
most 2 ^ ℓ + 1 evaluations of H (isQueryBounded_bruteForceHashFinder).