Documentation

CslibFrontier.Crypto.Computational.GenericGroup.DiscreteLog

Discrete logarithm in the generic group model #

The discrete-logarithm game in the generic group model of [BS23], Section 16.3, and the bound of Theorem 16.3 (p. 693): for prime q, an adversary that makes at most T queries to the group oracle outputs the discrete logarithm with probability at most ((3T + 2)² / 2 + 1) / q.

dlogGame A draws a uniform injective labeling L : ZMod q ↪ S and a uniform α : ZMod q, gives the adversary L 1 and L α, runs it against the group oracle of L (runLabeled) and wins when it outputs α. The adversary's budget is ProbOracleComp.IsQueryBounded: at most T labeling and group-operation queries on every path, whatever its private coins; coin draws are free.

This is a query bound on query-bounded programs in an idealized model; it assumes no computational hardness and is not a statement about any specific group: as the book says (p. 695), the bound says nothing about the difficulty of discrete logarithm in any specific group. It applies to adversaries that are otherwise unbounded.

As in the book, q is prime; the bound is not claimed for composite q. For groups of prime-power order the book reduces discrete logarithm to the prime case (Section 16.1.2, p. 684). The proof uses primality only in the fact that two distinct linear forms c X + d agree at no more than one point of ZMod q.

It differs from the book's setting as follows.

  1. S is any finite type, not a set of bit strings; Nonempty (ZMod q ↪ S) is the book's |S| ≥ q.
  2. The adversary may use private coins; the book's adversary is a computationally unbounded algorithm, and nothing beyond the query bound is assumed here either.
  3. The challenger does not make labeling queries; it reads L 1 and L α directly, which gives the same distribution.
  4. Groups are additive: the label of β stands for β • g, the book's g^β.

The proof follows the book's (Games 0–2) and is an instance of Cslib.Crypto.GenericGroup.succProbability_linearGame_le, the bound for games with linear inputs: one unknown α, no output labels, and the test that the output value is α, which holds at one point in q. That proof reduces to labels in ZMod q with a uniform permutation as labeling (Cslib.Crypto.GenericGroup.relabel), samples the permutation lazily, and replaces it by a table on linear forms that is identical until two distinct forms agree at α. The sharp form succProbability_dlogGame_le_choose is what the proof gives before the book rounds the number of pairs of forms, (3T + 2).choose 2, up to (3T + 2)² / 2. An adversary that wins with probability at least one half has q ≤ (3T + 2)² + 2 (le_of_half_le_succProbability_dlogGame), so T is at least about √q / 3, as the book remarks after the theorem (p. 695).

Main definitions #

Main results #

References #

noncomputable def Cslib.Crypto.GenericGroup.dlogGame {q : ℕ} {S : Type} [NeZero q] [Fintype S] [Nonempty (ZMod q ↪ S)] (A : S → S → ProbOracleComp (GroupOracleSpec q S) (ZMod q)) :

The discrete-logarithm game in the generic group model ([BS23], Theorem 16.3): a uniform injective labeling L and a uniform α; the adversary gets L 1 and L α, runs against the group oracle of L, and wins when it outputs α.

theorem Cslib.Crypto.GenericGroup.succProbability_dlogGame_le_choose {q : ℕ} {S : Type} [NeZero q] [Fintype S] [Nonempty (ZMod q ↪ S)] (hq : Nat.Prime q) {T : ℕ} {A : S → S → ProbOracleComp (GroupOracleSpec q S) (ZMod q)} (hA : ∀ (g u : S), (A g u).IsQueryBounded T) :
(dlogGame A).succProbability ≤ ↑((3 * T + 2).choose 2 + 1) / ↑q

Theorem 16.3, sharp form. For prime q and an adversary that makes at most T queries to the group oracle on every path, the discrete-logarithm game in the generic group model is won with probability at most ((3T + 2).choose 2 + 1) / q. This is the bound the proof of [BS23], Theorem 16.3, gives before it rounds (3T + 2).choose 2 up to (3T + 2)² / 2.

theorem Cslib.Crypto.GenericGroup.succProbability_dlogGame_le {q : ℕ} {S : Type} [NeZero q] [Fintype S] [Nonempty (ZMod q ↪ S)] (hq : Nat.Prime q) {T : ℕ} {A : S → S → ProbOracleComp (GroupOracleSpec q S) (ZMod q)} (hA : ∀ (g u : S), (A g u).IsQueryBounded T) :
(dlogGame A).succProbability ≤ ((3 * ↑T + 2) ^ 2 / 2 + 1) / ↑q

Theorem 16.3 ([BS23], p. 693, eq. (16.6)). For prime q and an adversary that makes at most T queries to the group oracle on every path, the discrete-logarithm game in the generic group model is won with probability at most ((3T + 2)² / 2 + 1) / q.

theorem Cslib.Crypto.GenericGroup.le_of_half_le_succProbability_dlogGame {q : ℕ} {S : Type} [NeZero q] [Fintype S] [Nonempty (ZMod q ↪ S)] (hq : Nat.Prime q) {T : ℕ} {A : S → S → ProbOracleComp (GroupOracleSpec q S) (ZMod q)} (hA : ∀ (g u : S), (A g u).IsQueryBounded T) (h : 1 / 2 ≤ (dlogGame A).succProbability) :
q ≤ (3 * T + 2) ^ 2 + 2

Success probability one half (the remark after Theorem 16.3, [BS23], p. 695). For prime q, an adversary that makes at most T queries to the group oracle on every path and wins the discrete-logarithm game with probability at least 1 / 2 has q ≤ (3T + 2)² + 2: T is at least about √q / 3.