RSA Encryption Algorithm
RSA Encryption Algorithm
o Public key
o Private key
The Public key is used for encryption, and the Private Key is used for
decryption. Decryption cannot be done using a public key. The two keys
are linked, but the private key cannot be derived from the public key. The
public key is well known, but the private key is secret and it is known only
to the user who owns the key. It means that everybody can send a
message to the user using user's public key. But only the user can decrypt
the message using his private key.
Example 1:
This example shows how we can encrypt plaintext 9 using the RSA public-
key encryption algorithm. This example uses prime numbers 7 and 11 to
generate the public and private keys.
Explanation:
p=7
q = 11
First, we calculate
n=pxq
n = 7 x 11
n = 77
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (7 - 1) x (11 - 1)
φ (n) = 6 x 10
ADVERTISEMENT
φ (n) = 60
ADVERTISEMENT
ADVERTISEMENT
To find ciphertext from the plain text following formula is used to get
ciphertext C.
C = me mod n
C = 97 mod 77
C = 37
Step 5: The private key is <d, n>. To determine the private key, we use
the following formula d such that:
m = cd mod n
m = 3743 mod 77
m=9
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p = 13
ADVERTISEMENT
q = 17
First, we calculate
n=pxq
n = 13 x 17
n = 221
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = 12 x 16
φ (n) = 192
Put k = 0
d = (1 + 0 x 192)/35
d = 1/35
Put k = 1
d = (1 + 1 x 192)/35
d = 193/35
Put k = 2
d = (1 + 2 x 192)/35
d = 385/35
d = 11
Example 3:
A RSA cryptosystem uses two prime numbers 3 and 13 to generate the
public key= 3 and the private key = 7. What is the value of cipher text for
a plain text?
Explanation:
Step 1: In the first step, select two large prime numbers, p and q.
p=3
q = 13
First, we calculate
n=pxq
n = 3 x 13
n = 39
To find ciphertext from the plain text following formula is used to get
ciphertext C.
C = me mod n
C = 53 mod 39
C = 125 mod 39
C=8
Example 4:
A RSA cryptosystem uses two prime numbers, 3 and 11, to generate
private key = 7. What is the value of ciphertext for a plain text 5 using the
RSA public-key encryption algorithm?
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p=3
q = 11
First, we calculate
n=pxq
n = 3 x 11
n = 33
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (3 - 1) x (11 - 1)
φ (n) = 2 x 10
φ (n) = 20
e x 7 = 1 mod 20
e x 7 = 1 mod 20
Put k = 0
e = (1 + 0 x 20) / 7
e = 1/7
Put k = 1
e = (1 + 1 x 20) / 7
e = 21/7
e=3