Deterministic run-cost analysis of rainbow-table and Hellman inversion #
Deterministic request-trace (OracleComp.queriesWith) cost bounds for rainbowAttack and
hellmanAttack ([BS23], Section 18.7, pp. 743–746), consuming the four decomposition
lemmas of CslibFrontier.Languages.Probabilistic.QueriesWith.Cost.
Correspondence with [BS23], Section 18.7 #
- Rainbow tables (p. 746; Fig. 18.13b, p. 744). Algorithm
A₁loopsi = τdown to1(step indexk = 0, ..., τ - 1testing columnτ - 1 - k).- As printed, line (2) computes
z ← f_τ(⋯ f_{i+1}(g_i(y)) ⋯), evaluatingfτ - i = ktimes at iterationi(0times ati = τ,1time ati = τ - 1, ...,τ - 1times ati = 1), so0 + 1 + ⋯ + (τ - 1) = τ * (τ - 1) / 2hash evaluations across allτsteps when every lookup misses (sum_map_hashCost_queriesWith_rainbowAttack_of_forall_lookup_eq_none). - Line (3) makes
1lookup inLper executed step, so at mostτlookups on any run (sum_map_lookupCost_queriesWith_rainbowAttack_le) andτlookups whenever the search returnsnone(sum_map_lookupCost_queriesWith_rainbowAttack_of_evalPure_eq_none). - On a table hit at step
k < τ, lines (4)–(5) spend(τ - 1 - k) + 1 = τ - kadditional hash evaluations (k + (τ - k) = τtotal for stepk:sum_map_hashCost_queriesWith_rainbowAttackStep). Across any run withhitscandidate endpoints present inL, total hash cost is at mostτ * (τ - 1) / 2 + hits * τ(sum_map_hashCost_queriesWith_rainbowAttack_le). When no table hit along the run is a false alarm, the first hit terminatesfindSomeM?, giving at mostτ * (τ - 1) / 2 + τ = τ * (τ + 1) / 2hash evaluations (sum_map_hashCost_queriesWith_rainbowAttack_le_of_no_false_alarm). Note on p. 746: the book states1 + 2 + ⋯ + τ = τ(τ + 1)/2 ≈ τ²/2for the worst-case work of line (2) alone and sets maximum running timet := τ²/2; ourτ * (τ + 1) / 2bound sums line (2)'s printed0 + ⋯ + (τ - 1)count plus lines (4)–(5) on a single hit, coinciding numerically with the book's line-(2) figure.
- As printed, line (2) computes
- Hellman's basic tradeoff (pp. 743–745; Fig. 18.13a, p. 744, and Fig. 18.14, p. 745).
hellmanAttackadvancesz ← g₀(h(z))by one step per iteration instead of recomputing fromy:- Across arbitrary oracle replies (even if every lookup is a false alarm), a run makes at most
τlookups and at mostτ * (τ + 3) / 2hash evaluations (sum_map_lookupCost_queriesWith_hellmanAttack_le,sum_map_hashCost_queriesWith_hellmanAttack_le), and at leastτhash evaluations (le_sum_map_hashCost_queriesWith_hellmanAttack). - Without false alarms, every run—whether inverted at step
k(k + (τ - 1 - k) + 1 = τ) or missing on allτlookups (τsingle-step advances)—makesτhash evaluations (sum_map_hashCost_queriesWith_hellmanAttack_of_no_false_alarm), matching p. 744 ("τevaluations offand at mostτlookups inL"). - A false alarm reached at iteration
k < τ(with only misses or false alarms beforek) adds at leastτ - kextra hash evaluations aboveτ(add_le_sum_map_hashCost_queriesWith_hellmanAttack_of_false_alarm).
- Across arbitrary oracle replies (even if every lookup is a false alarm), a run makes at most
Main results #
Cslib.Crypto.sum_map_lookupCost_queriesWith_rainbowAttackStep,Cslib.Crypto.sum_map_hashCost_queriesWith_rainbowAttackStep: per-step lookup (1) and hash (kon miss,τon hit fork < τ) query counts ofrainbowAttackStep.Cslib.Crypto.sum_map_lookupCost_queriesWith_rainbowAttack_le,Cslib.Crypto.sum_map_lookupCost_queriesWith_rainbowAttack_of_evalPure_eq_none: run lookup count≤ τ, with equality= τwhenrainbowAttackreturnsnone.Cslib.Crypto.sum_map_hashCost_queriesWith_rainbowAttack_of_forall_lookup_eq_none: exactτ * (τ - 1) / 2hash query count when allτlookups miss.Cslib.Crypto.sum_map_hashCost_queriesWith_rainbowAttack_le,Cslib.Crypto.sum_map_hashCost_queriesWith_rainbowAttack_le_of_no_false_alarm: run hash boundτ * (τ - 1) / 2 + hits * τ, specializing toτ * (τ + 1) / 2without false alarms.Cslib.Crypto.sum_map_lookupCost_queriesWith_hellmanAttack_le,Cslib.Crypto.sum_map_hashCost_queriesWith_hellmanAttack_le: unconditional run lookup (≤ τ) and hash (≤ τ * (τ + 3) / 2) bounds forhellmanAttack.Cslib.Crypto.sum_map_hashCost_queriesWith_hellmanLoop_succ,Cslib.Crypto.le_sum_map_hashCost_queriesWith_hellmanAttack,Cslib.Crypto.sum_map_hashCost_queriesWith_hellmanAttack_of_no_false_alarm,Cslib.Crypto.add_le_sum_map_hashCost_queriesWith_hellmanAttack_of_false_alarm: per-iteration recursion, lower boundτ, exact no-false-alarm count= τ, andτ + (τ - k)false-alarm lower bound forhellmanAttack.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Section 18.7, pp. 742–746.
Private trace and summation helpers #
Run-cost analysis of rainbowAttack #
Every step k of rainbowAttack makes 1 table lookup along a deterministic run.
At step k < τ, rainbowAttackStep makes k hash queries when lookup misses and τ hash
queries (k forward, τ - 1 - k backward from pw₀, 1 verification) when lookup hits.
Along any deterministic run, rainbowAttack makes at most τ table lookups
([BS23], Section 18.7, p. 746).
When rainbowAttack returns none, all τ steps execute and the run makes τ table
lookups.
Exact miss-run hash count of rainbowAttack ([BS23], Section 18.7, line 2 of
Algorithm A₁, p. 746): when no candidate endpoint hits the table, rainbowAttack evaluates
0 + 1 + ⋯ + (τ - 1) = τ * (τ - 1) / 2 hashes (τ - i evaluations at iteration i = τ down to
1 as printed on line 2).
General run hash bound of rainbowAttack. Along any deterministic run (including early
termination when a preimage is found), total hash evaluations are at most
τ * (τ - 1) / 2 + hits * τ, where hits counts steps k < τ whose candidate endpoint hits
lookup.
Rainbow-table run hash bound without false alarms (cf. [BS23], Section 18.7,
p. 746): when every table hit along the candidate endpoints yields a valid preimage of y, the
first hit terminates rainbowAttack, so the run makes at most τ * (τ + 1) / 2 hash evaluations
(0 + ⋯ + (τ - 1) = τ * (τ - 1) / 2 from line 2 as printed across i = τ down to 1, plus at
most τ from lines 4–5 reconstructing and verifying a single hit; this total coincides numerically
with p. 746's 1 + 2 + ⋯ + τ = τ(τ + 1)/2 ≈ τ²/2 figure stated for the worst-case work of line 2
alone in setting t := τ²/2).
Run-cost analysis of hellmanAttack #
Along any deterministic run, hellmanAttack makes at most τ table lookups
([BS23], Section 18.7, p. 744).
Along any deterministic run (even when every lookup is a false alarm), hellmanAttack makes at
most τ * (τ + 3) / 2 hash evaluations.
Zero remaining iterations of hellmanLoop make 0 hash evaluations.
One iteration of hellmanLoop at remaining depth m + 1 makes 1 hash evaluation before
recursing on a lookup miss, m + 1 hash evaluations on a verified hit, and m + 2 hash
evaluations before recursing on a false alarm.
Every deterministic run of hellmanAttack makes at least τ hash evaluations.
Hellman's hash count without false alarms ([BS23], Section 18.7, p. 744): when
every table hit along the queried orbit yields a valid preimage of y, hellmanAttack makes τ
hash evaluations (k single-step advances prior to a hit at step k, τ - 1 - k steps to
reconstruct pw, and 1 evaluation to check h(pw) = y; or τ single-step advances when all τ
lookups miss).
Extra hash cost of a false alarm in Hellman's attack ([BS23], Section 18.7,
pp. 744–745; Fig. 18.14, p. 745): a false alarm reached at iteration k < τ (with only misses or
false alarms at earlier iterations j < k) adds at least τ - k hash evaluations above τ.