Pohlig–Hellman algorithm

This is an old revision of this page, as edited by Andreas Kaufmann (talk | contribs) at 21:10, 13 March 2008 (Category:Number theoretic algorithms). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In mathematics, the Pohlig-Hellman algorithm is an algorithm for the computation of discrete logarithms in a multiplicative group whose order is a smooth integer. The algorithm is based on the Chinese remainder theorem.

We will explain the algorithm in terms of the group formed by taking all the elements of Zp which are coprime to p, and leave it to the advanced reader to extend the algorithm to other groups by using Lagrange's Theorem.

Input Integers p, g, e.
Output Integer x, such that e ≡ gx (mod p).
  1. Determine the prime factorization and totient of the order of the group :
  2. From the remainder theorem we know that x = a1 p1 + b1. We now find the value of b1 for which the following equation holds using a fast algorithm such as Baby-step giant-step :
    (using Euler's theorem)

    Note that if then the order of g is less than φ(p) and must be 1 for a solution to exist. In this case there will be more than one solution for x less than φ(p), but since we are not looking for the whole set, we can require that b1=0.

    The same operation is now performed for p2 up to pn.

    A minor modification is needed where a prime number is repeated. Suppose we are seeing pi for the k+1-th time. Then we already know ci in the equation x = ai pik+1 + bi pik+ci, and we find bi the same way as before.
  3. We end up with enough simultaneous congruences so that x can be solved using the Chinese remainder theorem.

References

  1. S. Pohlig and M. Hellman. "An Improved Algorithm for Computing Logarithms over GF(p) and its Cryptographic Significance", IEEE Trans. Information Theory 24, 1978, pp. 106-110.