Content deleted Content added
Chouhartem (talk | contribs) Pohlig-Hellman illustration |
Add one more link to Chinese remainder theorem |
||
(42 intermediate revisions by 32 users not shown) | |||
Line 1:
{{Short description|Algorithm for computing logarithms}}
[[File:Pohlig-Hellman-Diagram.svg|thumb|350px|alt=Pohlig Hellman Algorithm|Steps of the
In [[
The algorithm was
== Groups of prime-power order ==
As an important special case, which is used as a subroutine in the general algorithm (see below), the Pohlig–Hellman algorithm applies to [[Group (mathematics)|groups]] whose order is a [[prime power]]. The basic idea of this algorithm is to iteratively compute the <math>p</math>-adic digits of the logarithm by repeatedly "shifting out" all but one unknown digit in the exponent, and computing that digit by elementary methods.
(Note that for readability, the algorithm is stated for cyclic groups — in general, <math>G</math> must be replaced by the subgroup <math>\langle g\rangle</math> generated by <math>g</math>, which is always cyclic.)
:'''Input.''' A cyclic group <math>G</math> of order <math>n=p^e</math> with generator <math>g</math> and an element <math>h\in G</math>.
:'''Output.''' The unique integer <math>x\in\{0,\dots,n-1\}</math> such that <math>g^x=h</math>.
:# Initialize <math>x_0:=0.</math>
:# Compute <math>\gamma:=g^{p^{e-1}}</math>. By [[Lagrange's theorem (group theory)|Lagrange's theorem]], this element has order <math>p</math>.
:# For all <math>k\in\{0,\dots,e-1\}</math>, do:
:## Compute <math>h_k:=(g^{-x_k}h)^{p^{e-1-k}}</math>. By construction, the order of this element must divide <math>p</math>, hence <math>h_k\in\langle\gamma\rangle</math>.
:## Using the [[Baby-step giant-step|baby-step giant-step algorithm]], compute <math>d_k\in\{0,\dots,p-1\}</math> such that <math>\gamma^{d_k}=h_k</math>. It takes time [[Big O notation|<math>O(\sqrt p)</math>]].
:## Set <math>x_{k+1}:=x_k+p^kd_k</math>.
:# Return <math>x_e</math>.
The algorithm computes discrete logarithms in time complexity [[Big O notation|<math>O(e\sqrt p)</math>]], far better than the [[Baby-step giant-step|baby-step giant-step algorithm's]] [[Big O notation|<math>O(\sqrt{p^e})</math>]] when <math>e</math> is large.
== The general algorithm ==
In this section, we present the general case of the Pohlig–Hellman algorithm. The core ingredients are the algorithm from the previous section (to compute a logarithm modulo each prime power in the group order) and the [[Chinese remainder theorem]] (to combine these to a logarithm in the full group).
(Again, we assume the group to be cyclic, with the understanding that a non-cyclic group must be replaced by the subgroup generated by the logarithm's base element.)
:'''Input.''' A cyclic group <math>G</math> of order <math>n</math> with generator <math>g</math>, an element <math>h\in G</math>, and a prime factorization <math display="inline">n=\prod_{i=1}^rp_i^{e_i}</math>.
:'''Output.''' The unique integer <math>x\in\{0,\dots,n-1\}</math> such that <math>g^x=h</math>.
:# For each <math>i\in\{1,\dots,r\}</math>, do:
:## Compute <math>g_i:=g^{n/p_i^{e_i}}</math>. By [[Lagrange's theorem (group theory)|Lagrange's theorem]], this element has order <math>p_i^{e_i}</math>.
:## Compute <math>h_i:=h^{n/p_i^{e_i}}</math>. By construction, <math>h_i\in\langle g_i\rangle</math>.
:## Using the algorithm above in the group <math>\langle g_i\rangle</math>, compute <math>x_i\in\{0,\dots,p_i^{e_i}-1\}</math> such that <math>g_i^{x_i}=h_i</math>.
:# Solve the simultaneous congruence <math display="block">x\equiv x_i\pmod{p_i^{e_i}}
\quad\forall i\in\{1,\dots,r\}
\text{.}</math>The [[Chinese remainder theorem]] guarantees there exists a unique solution <math>x\in\{0,\dots,n-1\}</math>.
:# Return <math>x</math>.
The correctness of this algorithm can be verified via the [[Abelian group#Classification|classification of finite abelian groups]]: Raising <math>g</math> and <math>h</math> to the power of <math>n/p_i^{e_i}</math> can be understood as the projection to the factor group of order <math>p_i^{e_i}</math>.
==Complexity==
The worst-case
==Notes==
Line 27 ⟶ 45:
==References==
*{{cite book|title=An Introduction To Cryptography|url=https://archive.org/details/An_Introduction_to_Cryptography_Second_Edition|last=Mollin|first= Richard|date=2006-09-18|publisher=Chapman and Hall/CRC|edition=2nd|isbn=978-1-58488-618-1|page=[https://archive.org/details/An_Introduction_to_Cryptography_Second_Edition/page/n353 344]|ref=Mollin06}}
*{{cite journal |
*{{cite book|first1=Alfred J.|last1=Menezes|
{{Number-theoretic algorithms}}
|