RSA stands for Rivest-Shamir-Adleman (Name of the Creators of the algorithm)

Key Generation

(e, n) = Public Key
(d, n) = Private Key

e: RSA Exponent
n: RSA Modulus

Choose two prime numbers

p = 7
q = 11

Compute n

Compute ɸ(n)

Eulers Totient Function


Choose e

e should lie between and be co-prime to

e = 13
(e, n) = Public Key = (13, 60)

Determine d


e and ɸ(n) here are coprime (Found in above step)

Then we can say d is an multiplicative inverse of e.
The above equation can also be represented as :

Calculating without the knowledge of d (Private Key) is quite challenging
Hence without knowing the private key it is practically impossible to decrypt the message

We have to keep incrementing the value of i until we get an integer as the result

(d, n) = Private Key = (37, 60)

Encryption and Decryption

Modular Exponentiation

EncryptionDecryption
(e, n) = (13, 143) = Public Key
P = 13 = Plain Text
(d, n) = (37, 143) = Private Key
C = 52 = Cipher Text
C = , P < n
C =
P =
P =

C = 52 (Cipher Text)

P = 13

The Plain Text that is specified is the algorithm is the ASCII code of the character to be encoded