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 xd−a, 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=x∀x∈G
  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,…,gp−1}


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, p≡3(mod4):

(11107)=11107−12=1153=1(mod107), so it is a square, and since 11≠0, it has two roots. They are:

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


For q=127, p≡3(mod4):

(11127)=11127−12=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={±15⋅127(1127(mod107))±30⋅107⋅(1107(mod127))}={±15⋅127⋅91±30⋅107⋅19}={±10287±6634}

In summary, for p≡3(mod4),

  • compute Legendre symbol
  • find


BUT for p≡1(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 p≡1(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 p−1 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 (ag−e)p−12i≠1, then e=e+2i−1
  6. end
  7. h=ag−e
  8. a={±ge2ht+12}

Example

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

  • (11104729)=1, so square root exists
  • p≡1(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: 11p−122=1126192=31003≠1, so try e = 2
  4. e = 2: ...
  5. ...

Binary Search

2∣10472822∣104728(22)2∤10472823∣104728


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ℤ)*