- Bob generates two large primes, p and q

Probabilistic primality testing*O*((*lg n*)^{3}) - Bob computes n = pq and (n) = (p-1)(q-1)
- Bob chooses random e (1 < e < )
such that
gcd(e, (n)) = 1

Euclid's algorithm - Bob computes d =
*e*^{-1}mod (n)

Extended Euclid Algorithm*O*((*lg n*)^{2}) - Bob publishes n and e in a directory as his public key