RSA encryption example
Suppose we pick the primes p=3457631 and q=4563413. (In practice we might pick integers 100 or more digits each, numbers which are strong probable primes for several bases.) Suppose we also choose the exponent e=1231239 and calculate d so e d ≡ 1 (mod φ(n)). We now publish the key (n, e) = (15778598254603, 1231239).
To encrypt the message "George has green hair" we convert it to an integer. One simple idea (too simple for real use) is to let A be 1, B be 2, .... Then our message is
0705151807052 7080119270718 0505142718010 918.
For each of the four blocks (whose length was chosen so the blocks would represent integers no larger than n) we compute Be (mod n) (using the binary exponentiation). This gives the encrypted message:
1658228449402 5333403068473 7979527536648 13889903320423.
This message can be decrypted by raising each block to the d = 1315443185039th power modulo n.
See Also: RSA