Iterative Function to calculate (b^n) % m in O(log n)
Using the Euclidean approach
Two numbers are coprime if GCD is 1
if p is a prime number, and a is an integer, then
a^p = a % p
a^(p-1) = 1 % p
Choose two prime numbers p and q
Checking d: 0
Public key is (e, n) =>
Private key is (d, n) =>