Discussion 4A

Fermat’s Little Theorem

If pp is a a prime number and a{1,2,,p1}a \in \{1, 2, \cdots, p-1 \} then ap11modpa^{p-1} \equiv 1 \mod p.
Variation: if pp is prime then apamodpa^p \equiv a \mod p for any integer aa

Generalization

Let ϕ(n)\phi(n) be the number of integers between 11 and nn that are relatively prime with nn (this is Euler’s totient function). Then aϕ(n)1modna^{\phi(n)} \equiv 1 \mod n.

RSA

Premise: Alice wants to securely send a message xx to Bob

Procedure

  1. Bob chooses two primes pp and qq, and lets N=pqN = p q
  1. Bob finds ee and dd which are multiplicative inverses mod(p1)(q1)\mod (p-1) (q-1)
  1. this means ee and dd are relatively prime with (p1)(q1)(p-1) (q-1)
  1. Bob posts his public key (N,e)(N, e) to the world and keeps dd private
  1. Alice sends Bob the value of E(x)=xemodNE(x) = x^e \mod N
  1. Bob receives E(x)E(x) and decrypts it using the function D(y)=ydmodND(y) = y^d \mod N
  1. D(E(x))=E(x)d=(xe)d=xedmodND(E(x)) = E(x)^d = (x^e)^d = x^{e d} \mod N
  1. It turns out that xed=xmodNx^{e d} = x \mod N, which is the original message