MATH 470 Lecture 9

From Notes
Jump to navigation Jump to search

« previous | Tuesday, February 12, 2013 | next »


Review

  • method to apply fast square roots mod n to factoring.
  • (much earlier) fast factoring implies fast computation of ϕ(n), which implies breaking RSA


Let p be prime.

Proposition. A polynomial (f/p)[x] [1] of degree d has at most d roots in /p.

Corollary. A number in /p has at least d dth roots in /p for prime p.

Proof. ad is a root of xda, which has degree d.

We'll just focus on d=2.


Can a have 0 square roots mod 7? (yes, 6) Can a have 1 square root mod 7? (yes, 0, and it's the only one. Any other would have ± that number)

Abelian Group

An Abelian Group (G,*) is a set with a multiplication operation satisfying certain axioms:

  1. There is a multiplicative identity e: e*x=x*e=xxG
  2. Every x has a multiplicative inverse: x*y=y*x=e
  3. * is associative
  4. * is commutative

Examples:

  • (,+) with identity 0
  • ({0},*) with identity 1
  • (/p,+) with identity 0
  • ((/p)*,*) with identity 1

Cyclic

An Abelian group is cyclic when it has a generator [2]

Example: (/29)* is cyclic with generator 2 in that {20=1,21,22,,227(mod29)}={1,2,4,,28}

Note: Finding generators is not trivial
Corollary

Theorem: (/p)* is cyclic.

Corollary: Exactly half of the elements of (/p)* (for odd prime p )are squares. They are {g0,g2,g4,,gp1}


Corollary Puzzle

How can we find a quadratic non-residue (not a square) mod 982741? (choose a prime less than p)

Finding non-squares mod p is easy with 50% success probability!

Working with Square Roots mod pq

Idea: work mod p, then mod q, then piece together with Chinese Remainder Theorem.

If p and q are the primes 107 and 127, and n=pq=13589. What is/are 11(modn)?

First, if you have 11(modpq), you must certainly have 11(modp) and 11(modq).


For p=107, p3(mod4):

(11107)=1110712=1153=1(mod107), so it is a square, and since 110, it has two roots. They are:

11{11p+14,11p+14}={±15}


For q=127, p3(mod4):

(11127)=1112712=1163=1(mod127), so it is a square and has two roots. They are:

11{11p+14,11p+14}={±30}


Can we find an x with the following?

x±15(mod107)x±30(mod127)

Yes! There are four possible combinations of the above, and we can find all of them by the Chinese Remainder Theorem.

Wait, there are 4 square roots?

There are 4 roots (no more) because it has to simultaneously be a root of each of the prime factors. There are only four possibilities for n=pq

To find our square roots, it's helpful to know x and y with 107x+127y=1 (Extended Euclidean Algorithm): (x,y)=(19,16)

The Chinese Remainder Theorem says that

11={±15127(1127(mod107))±30107(1107(mod127))}={±1512791±3010719}={±10287±6634}

In summary, for p3(mod4),

  • compute Legendre symbol
  • find


BUT for p1(mod4), you can compute square roots mod p efficiently, but it looks like randomness is unavoidable.

Tonelli's Algorithm

Tonelli (1891)

Given any odd prime p1(mod4), you can find a(modp), should it exist, as follows:

  1. Find a non-square mod p (call it g) (easy with 50% probability)
  2. Write p1 in the form t2s with odd t (easy via binary search)
  3. let e=0
  4. for i from 2 to s, do
  5. if (age)p12i1, then e=e+2i1
  6. end
  7. h=age
  8. a={±ge2ht+12}

Example

For p=104729, what is 11(modp)?

  • (11104729)=1, so square root exists
  • p1(mod4), so we have the nasty case
  1. Find a non-square: 42? non-square! (first guess!)
  2. 104729 - 1 = 104728 = 23 · 13091
  3. e = 0: 11p122=1126192=310031, so try e = 2
  4. e = 2: ...
  5. ...

Binary Search

210472822104728(22)210472823104728


Final Note: A key to using RSA in practice is generating primes. How do we do this? (understand distribution of primes)


Footnotes

  1. Polynomials in one variable with coefficients in /p.
  2. a number whose powers produce every number in (/p)*