Example of the Pohlig-Hellman Technique for finding discrete logarithms

Let the prime p = 8101, and a generator of Z8101 be a = 6. Find x so that

ax = 7531 mod 8101.

Observe that p-1 = 8100 = (22)(34)(52), is a product of small primes. We shall determine the numbers x2 = x mod (22), x3 = x mod (34) and x5 = x mod (52).

Determination of x2.

Since x2 is a number mod 4, we have x2 = c0 + c1 (2), with the coefficients being either 0 or 1. We determine these coefficients as follows.

7531(p-1)/2 = 75314050 = -1 and as this = ac0 (p-1)/2, we have c0 = 1.
Now, divide 7531 by ac0 to get
7531(a-1) = 7531(6751) = 8006 mod p.
8006(p-1)/4 = 80062025 = 1 and as this = ac1 (p-1)/2, we have c1 = 0.

x2 = c0 + c1 (2) = 1 + 0(2) = 1.

Determination of x3.

Since x3 is a number mod 81, we have x3 = c0 + c1 (3) + c2 (9) + c3 (27), with the coefficients being either 0, 1 or 2. It will be of use to know the numbers a(p-1)/3 = 5883, and a2(p-1)/3 = 2217.

7531(p-1)/3 = 2217, so c0 = 2.
Now divide 7531 by ac0 to get
7531(a-2) = 6735 mod p.
6735(p-1)/9 = 1, so c1 = 0.
Now divide 6735 by a3c1 to get
6735(a0) = 6735 mod p.
6735(p-1)/27 = 2217, so c2 = 2.
Now divide 6735 by a9c2 to get
6735(a-18) = 6992 mod p.
6992(p-1)/81 = 5883, so c3 = 1.

x3 = 2 + 0(3) + 2(9) + 1(27) = 47.

Determination of x5.

Since x5 is a number mod 25, x5 = c0 + c1 (5), with the coefficients being either 0, 1, 2, 3 or 4. We need to compute a(p-1)/5 = 3547, a2(p-1)/5 = 356, a3(p-1)/5 = 7077, a4(p-1)/5 = 5221.

7531(p-1)/5 = 5221, so c0 = 4.
Divide 7531 by ac0 to get
7531(a-4) = 7613 mod p.
7613(p-1)/25 = 356, so c1 = 2.

x5 = 4 + 2(5) = 14.

Determination of x.

We now use the Chinese Remainder Theorem to compute the common solution of the congruences, M1 = 8100/(4) = 2025
y1 = M1-1 mod 4, y1 = 1.

M2 = 8100/81 = 100
y2 = M2-1 mod 81, y2 = 64.

M3 = 8100/25 = 324
y3 = M3-1 mod 25, y3 = 24.

x = 1(2025)(1) + 47(100)(64) + 14(324)(24) = 6689 mod 8100.


Return to index (non-frame version)