Docsity

Modular Arithmetic - Discrete Math - Lecture Slides, Slides of Discrete Mathematics

Partial preview of the text

Download Modular Arithmetic - Discrete Math - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

Modular Arithmetic and

the RSA Cryptosystem

p-

p 1

Starring

Rivest Shamir^ Adleman

Euler (^) Fermat

Pick secret, random large primes: p,q “Publish”: n = p*q

φ(n) = φ(p) φ(q) = (p-1)*(q-1) Pick random e ∈ Z *φ(n) “Publish”: e Compute d = inverse of e in Z φ(n) Hence, ed = 1 [ mod φ(n) ]

“Private Key”: d

Mumbo jumbo…

More Mumbo jumbo…

n,e is my public key. Use it to send me a message.

p,q random primes, e random ∈ Zφ(n) n = pq e*d = 1 [ mod φ(n) ]

But how does it all work?

  • What is φ(n)?
  • What is Zφ(n)*^?
  • …
  • Why do all the steps work?

To understand this, we need a little number theory...

MAX(a,b) + MIN(a,b) = a+b

Greatest Common Divisor:

GCD(x,y) = greatest k ≥ 1 s.t. k|x and k|y.

Least Common Multiple:

LCM(x,y) = smallest k ≥ 1 s.t. x|k and y|k.

GCD(x,y) × LCM(x,y) = xy

MAX(a,b) + MIN(a,b) = a+b

(a mod n) means the remainder when a is divided by n.

If a = dn + r with 0 ≤ r < n Then r = (a mod n) and d = (a div n)

31 ≡ 81 [mod 2]

≡n is an equivalence relation

In other words, Reflexive: a ≡n a Symmetric: (a ≡n b) ⇒ (b ≡n a) Transitive: (a ≡n b and b ≡n c) ⇒ (a ≡n c)

a ≡n b ⇔ n|(a-b)

“a and b are equivalent modulo n”

Define Residue class [i] = the set of all integers that are congruent to i modulo n.

Residue Classes Mod 3:

[0] = { …, -6, -3, 0, 3, 6, ..}

[1] = { …, -5, -2, 1, 4, 7, ..}

[2] = { …, -4, -1, 2, 5, 8, ..}

[-6] = { …, -6, -3, 0, 3, 6, ..}

[7] = { …, -5, -2, 1, 4, 7, ..}

[-1] = { …, -4, -1, 2, 5, 8, ..}