MATH 470 Lecture 16

From Notes
Jump to navigation Jump to search

« 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 p with p1 having at least 1 large factor. Otherwise, you can easily break El Gamal easily via the Pohlig-Hellman method:

input: prime p, α,β(/p)* such that β=αa(modp)

output: a

  1. factor p1 as 2r13r2pnrn
  2. find an ai with aai(modpiri) for all i[1,n]
  3. Recover a from a1,,an via the Chinese Remainder Theorem.

Main trick to (2) is to expand a in base pi: a=d0+d1pi+d2pi2++dnpin=(αd0)(αd1)pi(αdn)pin

Example

Last time, we used a prime with p1 having many small primes and no power greater than 1.

This time, we'll use a prime with p1 having only one prime and a large power:

p = 65537 R = Integers(p) alpha = R(3) beta = R(2) factor(p-1) # => 2^16


    1. FIND d0 ##
  1. beta^((p-1)/2) == (alpha^a)^((p-1)/2)

beta^((p-1)/2) # => 1

  1. (alpha^a)^((p-1)/2) == (3^d0)^((p-1)/2) * (3^(2*d1))^((p-1)/2) * ...
  2. == (3^((p-1)/2))^d0 * (3^(p-1))^d1 * ...
  3. == 3^(d0*(p-1)/2) * 1 * 1 * ...

3^((p-1)/2) # => -1

  1. d0 == 0 since (-1)^d0 == 1

d0 = 0

    1. FIND d1 ##
  1. beta = (alpha^d0) * (alpha^d1)^2 * ... * (alpha^d15)^(2^15)
  2. therefore beta/alpha^d0 == (alpha^d1)^2 * ... * (alpha^d15)^(2^15)

beta/alpha^d0 # => 2

  1. raise both sides to the (p-1)/2^2 th power
  2. 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)
  3. == (alpha^((p-1)/2))^d1 * 1 * 1 * ... * 1

R(2)^((p-1)/2^2) # => 1 alpha^((p-1)/2) # => -1

  1. d1 == 0 since (-1)^d0 == 1

d1 = 0


    1. FIND d2 ##
  1. beta/alpha^(d0+2*d1) == alpha^(d2*2^2) * alpha^(d15*2^15)

beta/alpha^(d0+2*d1) # => 2

  1. raise to (p-1)/2^3 power
  2. 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

  1. d2 == 0 since (-1)^d2 == 1

d2 = 0

    1. CONTINUE IN SAME WAY ##
  1. . . .
  2. a = 55296

Proof Example

Prove Fermat's Little Theorem.

Proposition. Given any a and prime p, then ap11(modp).

Proof. Consider the numbers a, 2a, …, (p1)a. They are distinct mod p since

iaja(modp)(ij)a0(modp)ij0(modp)ij(modp)

We can divide by a in step 3 since GCD(a,p)=1.

So then {a,2a,3a,,(p1)a}={1,,p1}

If we multiply all elements of these sets, we get

ap1(p1)!=(p1)!(modp)ap1=1(modp)

Q.E.D.


Non-Computational Example

Find k such that computing the exact power of 3 dividing n is doable in time O(logk(N))

Hint: You may assume that multiplying or dividing two numbers no bigger than n takes time O(log2n)

Solution: Use binary search

Check if N is divisible by 3, 32, 34, etc.

At a certain point, we get 32jn, but 32j+1n. Note 32jn, so

32j=n2j=log3nj=log2(log3n)

So checks take O((loglogn)(log2n)).


Suppose n=645,700,815. 324n, but 24 is not the highest power dividing n.

Replace n by n=n32j

Example: n=n324=15

Note nn3 since 32j+1n. Now proceed recursively:

This takes at most log3n binary searches, and since each binary search takes O((loglogn)(log2n)) time, the total work is:

O((loglogn)(log3n))

Now k=3+ϵ for any ϵ>0 since we have that loglogn factor.


Moral

Factoring n may take exponential time (in logn), but computing the unique j with n=pjm for pm is doable in polynomial time (in logn).