« previous | Thursday, March 7, 2013 | next »
Pohlig-Hellman
Recall:
- The security of RSA is based on the (apparent) hardness of integer factoring.
- The security of El Gamal is based on the (apparent) hardness of discrete logarithms.
For El Gamal, you should really only use with having at least 1 large factor. Otherwise, you can easily break El Gamal easily via the Pohlig-Hellman method:
input: prime , such that
output:
- factor as
- find an with for all
- Recover from via the Chinese Remainder Theorem.
Main trick to (2) is to expand in base :
Example
Last time, we used a prime with having many small primes and no power greater than 1.
This time, we'll use a prime with having only one prime and a large power:
p = 65537
R = Integers(p)
alpha = R(3)
beta = R(2)
factor(p-1) # => 2^16
- FIND d0 ##
- beta^((p-1)/2) == (alpha^a)^((p-1)/2)
beta^((p-1)/2) # => 1
- (alpha^a)^((p-1)/2) == (3^d0)^((p-1)/2) * (3^(2*d1))^((p-1)/2) * ...
- == (3^((p-1)/2))^d0 * (3^(p-1))^d1 * ...
- == 3^(d0*(p-1)/2) * 1 * 1 * ...
3^((p-1)/2) # => -1
- d0 == 0 since (-1)^d0 == 1
d0 = 0
- FIND d1 ##
- beta = (alpha^d0) * (alpha^d1)^2 * ... * (alpha^d15)^(2^15)
- therefore beta/alpha^d0 == (alpha^d1)^2 * ... * (alpha^d15)^(2^15)
beta/alpha^d0 # => 2
- raise both sides to the (p-1)/2^2 th power
- 2^((p-1)/2^2) == alpha^(2*d1*(p-1)/2^2) * alpha^(2^2*d1*(p-1)/2^2) * ... * alpha^(2^15*d15*(p-1)/2^2)
- == (alpha^((p-1)/2))^d1 * 1 * 1 * ... * 1
R(2)^((p-1)/2^2) # => 1
alpha^((p-1)/2) # => -1
- d1 == 0 since (-1)^d0 == 1
d1 = 0
- FIND d2 ##
- beta/alpha^(d0+2*d1) == alpha^(d2*2^2) * alpha^(d15*2^15)
beta/alpha^(d0+2*d1) # => 2
- raise to (p-1)/2^3 power
- 2^((p-1)/2^3) == alpha^(4*d2*(p-1)/2^3) * 1 * ... * 1
R(2)^((p-1)/2^3) # => 1
alpha^(4*(p-1)/2^3) #=> -1
- d2 == 0 since (-1)^d2 == 1
d2 = 0
- CONTINUE IN SAME WAY ##
- . . .
- a = 55296
Proof Example
Prove Fermat's Little Theorem.
Proposition. Given any and prime , then .
Proof. Consider the numbers , , …, . They are distinct mod since
We can divide by in step 3 since .
So then
If we multiply all elements of these sets, we get
Q.E.D.
Non-Computational Example
Find such that computing the exact power of 3 dividing is doable in time
Hint: You may assume that multiplying or dividing two numbers no bigger than takes time
Solution: Use binary search
Check if is divisible by 3, 32, 34, etc.
At a certain point, we get , but . Note , so
So checks take .
Suppose . , but is not the highest power dividing .
Replace by
Example:
Note since . Now proceed recursively:
This takes at most binary searches, and since each binary search takes time, the total work is:
Now for any since we have that factor.
Moral
Factoring may take exponential time (in ), but computing the unique with for is doable in polynomial time (in ).