Fermat's Little Theorem
The theorem states that for any prime p and any number a∈{1,...p−1} we have that ap−1≡1 mod p.
RSA
RSA starts off with two primes, p and q.
We have N:=pq and a number e such that gcd(e,(p−1)(q−1))=1. Our private key is d:=e−1(mod(p−1)(q−1))
Encryption
E(x)=xemod N Decrpytion
D(x)=ydmod N