MATH 470 Lecture 6

From Notes
Jump to navigation Jump to search

« previous | Tuesday, January 29, 2013 | next »


Euler Totient Function

Very important function in number theory

  • It's fundamental in the arithmatic of /n (e.g. Euler's theorem)
  • It has fundamental applications in RSA

For any prime p and k,

ϕ(pk)=pkpk1=(p1)pk1

Proof

To count the number of integers in {x,,pk1} that are relatively prime to pk, just expand

Any such x in base p:

x=d0+d1p++dk1pk1

with

(d0,,dk1){0,,p1}k1

where di is the remainder of x÷pidi1

Now GCD(x,pk)>1GCD(x,p)>1pxd0=0

There are exactly pk1 numbers with last digit d0=0, so therefore

ϕ(pk)=pkpk1
Q.E.D.

Lemma

ϕ is weakly multiplicative; that is, if m,n with GCD(m,n) = 1, then ϕ(mn)=ϕ(m)ϕ(n)

Proof.

Q.E.D.


RSA Review

Start with primes p and q with approx. equal number of digits, and e(/pq)*. Compute n=pq and d with de1(modϕ(n)).

  • Public: (n, e)
  • Private: (p,q,d)


Why Does Decryption Work?

c=me(modn)

Why is cd=m?

Proof.

cd=(me)d=mde(modn)=m1+Nϕ(n)(modn)by construction=m((m)ϕ(n))N(modn)=m1N(modn)by Euler=m(modn)

How to break RSA If you can factor n (which is a(n) (apparently) very difficult to do, by the way), then you can get p and q. You can then do this:

  1. Compute ϕ(n)=(p1)(q1)
  2. Solve de1(modϕ(n)) for d
  3. Doing the Extended Euclidean Algorithm is much faster than factoring!!!

If you gnow ϕ(n), you can do the same...

Oddly, computing ϕ(n) and factoring n are actually almost equivalent complexity!

Lemma

If n=pq for primes p and q, then p and q are exactly the roots of x2(nϕ(n)+1)x+n=0

Proof.

nϕ(n)+1=pq(p1)(q1)+1=p+q

Our quadratic = x2(pq)x+pq

Quadratics are easy to solve approximately over , but square roots are hard to calculate in (/n)*


Chinese Remainder Theorem

If m and n are relatively prime integers and a and b are any integers, then the simultaneous congruences

xa(modm)xb(modn)

have a unique solution, in particular in /mn


xan(1n(modm))+bm(1m(modn))(modmn)

Proof

Proof. (The formula works)

the stated formula, mod m, reduces to:

xan(1m(modm))a(modm)

Similarly, mod n, reduces to:

xb(modn)


Uniqueness: if x1,x2/mn are both solutions, then

x1x20(modm)x1x20(modn)m(x1x2)n(x1x2)mn(x1x2)x1x20(modmn)

Example

If you have fewer than 255 books and

  • after stacking by 15, you have 3 leftovers
  • after stacking by 17, you have 4 leftover

How many books do you have?

Let n be the number of books. Equivalently, n3(mod15)n4(mod17)

Therefore,

n=317(117(mod15))+415(115(mod17))=3178+415(9)=123

Kerckhoffs' Principle

(See wikipedia:Kerckhoffs's principle→)

Any cryptosystem should remain secure even if all (except key) is known.

(c.f. security by obscurity)

This is why RSA is so good.


Complexity

How hard is it to...

  • multiply two d-digit integers? (10dlog2(d)log2(log2(d)) bit operations)
  • reduce one d-digit integer mod another? (17dlog2(d)log2(d)log2(log2(d)) bit operations)
  • compute ae(modn)? (O(loge(logn)2))

10dlog2(d)log2(log2(d)) seems beeter than O(d2). For large d, you want to NOT use the grade school multiplication algorithm. Use this instead.

Rule of thumb: case approx. number of digits:

  • < 100: grade school is best.
  • 100..200: Karatsuba
  • > 200: FFT

Note: Architecture matters:

  • Humans: Grade school multiplication is best for fewer than 4 digits (with some tricks), anything beyond we use computers
  • Computer: Depending on chips/memory, number of digits dictates the algorithm.

Bit Operation?

  • bit-by-bit operation: 1+1, 1×0, shift by a bit
  • (with some constancy) digit-by-digit operation



Big-Oh Notation

(See Asymptotic Analysis→)


We say two functions f,g: satisfying f=O(g) iff there are constants c,m>0 with

|f(x)|m|g(x)|xC

Example:

  • Grade school, every digit is multiplied by every other digit with added carry digits. O(d2).
  • Gaussian Elimination takes O(n3) arithmetic operations to reduce an n×n matrix to row-echelon form.


Until Next Time

Quiz on Tuesday

Be able to compute stuff like ae(modn)