Pohlig–Hellman subgroup reduction, digit step, and composite-order transcript extraction #
In a finite cyclic group $G = \langle g \rangle$ of composite order $q$, the Pohlig–Hellman algorithm ([KL20], Section 10.2.1, pp. 374–375) reduces the discrete-logarithm problem in $G$ to discrete logarithms in subgroups of order $q_i$ for a factorization $q = \prod_i q_i$ into pairwise coprime factors, and recombines the residues via the Chinese Remainder Theorem. This file proves the correctness core of that reduction, a digit step used in KL's prime-power refinement, and some further composite-order extraction lemmas of our own:
- Subgroup reduction and CRT uniqueness (
pohligHellman_subgroup_modEq,pohligHellman_crt_modEq) ([KL20], Section 10.2.1, Equation (10.2), Lemma 10.4 and the paragraph after it, pp. 374–375): if $h = g^x$ and $x_i$ solves $(g^{q/q_i})^{x_i} = h^{q/q_i}$, then $x_i \equiv x \pmod{q_i}$; hence any $y$ with $y \equiv x_i \pmod{q_i}$ for every $i$ satisfies $y \equiv x \pmod q$. The algorithm itself, the subgroup solvers, and its running time are not formalised. - Prime-power digit step (
pohligHellman_step,pohligHellman_nsmul_step), an ingredient of [KL20], Exercises 10.4(a)–(b) and 10.5 (pp. 382–383): suppose $D p \mid q$ and $x \bmod D$ has already been recovered. Raising $g^x \cdot g^{q - (x \bmod D)}$ to the exponent $q / (D p)$ projects onto the subgroup of order $p$ generated by $g^{q/p}$ and isolates the next base-$p$ digit $t = \lfloor x / D \rfloor \bmod p$: $$(g^x \cdot g^{q - (x \bmod D)})^{q / (D p)} = (g^{q/p})^{t} \iff t = (x / D) \bmod p.$$
The remaining material is original to this library and is not taken from [KL20]: a smooth/rough trial-division split of $q$, combined with special-soundness extraction from two Schnorr transcripts in a composite-order group.
- Smooth/rough factor decomposition (
smoothDivisorSeq): Iterated trial division up to a bound $T + 1$ decomposes $q = D \cdot L$ where $D = \text{smoothDivisorSeq}(q, T, m \cdot T)$ is $(T + 1)$-smooth (smoothDivisorSeq_prime_le) and, once $q < 2^m$, the cofactor $L = q / D$ has no prime factors $\le T + 1$ (smoothDivisorSeq_not_dvd_div), making $D$ and $L$ coprime (coprime_smoothDivisorSeq_div) and every prime divisor of $L$ strictly greater than $T + 1$ (prime_gt_of_dvd_div_smoothDivisorSeq). - CRT combination and composite-order transcript extraction
(
hasLargePrimeCollision,coprime_challenge_diff,extractModRough,crtCombine,schnorr_transcript_relation,crtCombine_extractModRough_eq): Given $x \bmod D$ for the $(T + 1)$-smooth part $D$ and two accepting Schnorr transcripts $(r_1, s_1), (r_2, s_2)$ without a collision modulo any prime factor $p > T$ of $q$, the challenge difference is coprime to the $(T + 1)$-rough cofactor $L$ (coprime_challenge_diff), soextractModRoughrecovers $x \bmod L$ andcrtCombinereconstructs the full discrete logarithm $x < q$.crtCombineand its correctnesscrtCombine_eqare inCslibFrontier/Foundations/Data/Nat/ChineseRemainder.lean, which this module imports publicly.
Main definitions #
Cslib.Crypto.smoothDivisorSeq: trial-division schedule accumulating factors≤ T + 1ofq.Cslib.Crypto.hasLargePrimeCollision: Boolean predicate testing whether two challenges collide modulo any prime factorp > Tofq.Cslib.Crypto.extractModRough: recoversx % Lfrom a linear transcript relation moduloqusing an inverse of the challenge difference moduloL.
Main results #
Cslib.Crypto.pohligHellman_subgroup_modEq,Cslib.Crypto.pohligHellman_crt_modEq: correctness of the Pohlig–Hellman subgroup reduction and CRT uniqueness ([KL20], Section 10.2.1).Cslib.Crypto.pohligHellman_step,Cslib.Crypto.pohligHellman_nsmul_step: prime-power digit step (ingredient of [KL20], Exercises 10.4(a)–(b) and 10.5).Cslib.Crypto.smoothDivisorSeq_dvd,Cslib.Crypto.smoothDivisorSeq_prime_le,Cslib.Crypto.smoothDivisorSeq_not_dvd_div,Cslib.Crypto.coprime_smoothDivisorSeq_div,Cslib.Crypto.prime_gt_of_dvd_div_smoothDivisorSeq: correctness, $(T + 1)$-smoothness, cofactor roughness, and coprimality of the trial-division schedule (original).Cslib.Crypto.coprime_challenge_diff,Cslib.Crypto.extractModRough_eq_mod,Cslib.Crypto.crtCombine_extractModRough_eq: Chinese Remainder Theorem combination and composite-order discrete-logarithm extraction (original).Cslib.Crypto.schnorr_transcript_relation,Cslib.Crypto.schnorr_nsmul_transcript_relation: two accepting Schnorr transcripts with the same commitment satisfys₁ - s₂ = x * (r₁ - r₂)inZMod qforgof arbitrary orderq(original).
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, 3rd ed., Section 10.2.1 (The Pohlig–Hellman Algorithm, pp. 374–375) and Exercises 10.4(a)–(b) and 10.5 (pp. 382–383).
Pohlig–Hellman subgroup reduction #
Pohlig–Hellman subgroup reduction ([KL20], Section 10.2.1, Equation (10.2) and
Lemma 10.4, p. 375): if g has order q > 0, qi ∣ q, and xi solves the subgroup instance
(g ^ (q / qi)) ^ xi = (g ^ x) ^ (q / qi), then xi ≡ x [MOD qi].
Additive Pohlig–Hellman subgroup reduction: if g has additive order q > 0, qi ∣ q,
and xi • ((q / qi) • g) = (q / qi) • (x • g), then xi ≡ x [MOD qi].
Pohlig–Hellman CRT uniqueness ([KL20], Section 10.2.1, p. 375): let g have
order q = ∏ qs with pairwise coprime qs, let h = g ^ x, and let sol qi solve each subgroup
instance (g ^ (q / qi)) ^ sol qi = h ^ (q / qi). Then every y with y ≡ sol qi [MOD qi] for
all qi ∈ qs satisfies y ≡ x [MOD q], so the residues determine x modulo q.
Additive Pohlig–Hellman CRT uniqueness: for g of additive order q = ∏ qs with pairwise
coprime qs, h = x • g, and sol qi • ((q / qi) • g) = (q / qi) • h for all qi ∈ qs, every
y with y ≡ sol qi [MOD qi] for all qi ∈ qs satisfies y ≡ x [MOD q].
Pohlig–Hellman prime-power digit step #
Pohlig–Hellman prime-power digit step (ingredient of [KL20],
Exercises 10.4(a)–(b) and 10.5, pp. 382–383): for an element g of order q > 0 in a group M,
a divisor D * p ∣ q, and a candidate digit t < p, the subgroup projection
(g ^ x * g ^ (q - x % D)) ^ (q / (D * p)) equals (g ^ (q / p)) ^ t if and only if
t = x / D % p.
Additive Pohlig–Hellman prime-power digit step: for an element g of additive order
q > 0, a divisor D * p ∣ q, and a candidate digit t < p,
(q / (D * p)) • (x • g + (q - x % D) • g) = t • ((q / p) • g) if and only if
t = x / D % p.
Trial-division divisor schedule: at step k, the candidate factor is k % T + 2, and the
accumulated divisor grows by k % T + 2 whenever the product divides q.
Every term of smoothDivisorSeq q T divides q.
When 0 < q, every term of smoothDivisorSeq q T is positive.
One trial-division step never loses divisibility: smoothDivisorSeq q T k divides
smoothDivisorSeq q T (k + 1).
smoothDivisorSeq q T is divisibility-monotone in the step count k.
$(T + 1)$-smoothness of smoothDivisorSeq: every prime factor ℓ of
smoothDivisorSeq q T k satisfies ℓ ≤ T + 1.
Exhaustion of small prime factors: after m passes of length T (q < 2 ^ m), no prime
ℓ ≤ T + 1 divides the cofactor q / smoothDivisorSeq q T (m * T).
Coprimality of the smooth divisor and its cofactor: for 0 < q < 2 ^ m and 0 < T,
smoothDivisorSeq q T (m * T) and q / smoothDivisorSeq q T (m * T) are coprime.
Every prime factor of the cofactor q / smoothDivisorSeq q T (m * T) exceeds T + 1.
CRT combination and composite-order transcript extraction (original) #
Boolean test for whether two challenges r₁, r₂ collide modulo some prime factor p > T of
the group order q.
When no prime factor p > T of q divides r₁ - r₂
(hasLargePrimeCollision T q r₁ r₂ = false), the shifted challenge difference
(r₁ + (q - r₂)) % L is coprime to any divisor L ∣ q whose prime factors all exceed T.
Recover x % L from two transcript responses (s₁, s₂) and an inverse inv of the challenge
difference modulo L.
Given the linear transcript relation s₁ - s₂ = x * (r₁ - r₂) in ZMod q and an inverse inv
of (r₁ + (q - r₂)) % L modulo a divisor L ∣ q, extractModRough q L s₁ s₂ inv equals
x % L.
Composite-order discrete-logarithm recovery (original): combining a residue
a = x % D on the smooth divisor D with extractModRough on the cofactor L (where
D * L = q) recovers the exact discrete logarithm x < q, given an inverse of D modulo L.
Schnorr transcript congruence in a cyclic group (original): if g has order q and two
transcripts (r₁, s₁) and (r₂, s₂) share the same commitment
g ^ s₁ * (g ^ x) ^ (-r₁) = g ^ s₂ * (g ^ x) ^ (-r₂), then s₁ - s₂ = x * (r₁ - r₂) in
ZMod q.
Additive Schnorr transcript congruence: if g has additive order q and two transcripts
(r₁, s₁) and (r₂, s₂) share the same commitment
s₁ • g + (-r₁) • (x • g) = s₂ • g + (-r₂) • (x • g), then s₁ - s₂ = x * (r₁ - r₂) in
ZMod q.