RSA ALGORITHM

Generate two large random prime numbers, p and q.

Calculate n = p * q. For strong unbreakable encryption, let n be a large number, typically a minimum of 512 bits.

Choose an integer e, which must be greater than 1 and less than (p − 1)(q − 1). There must be no common factor for e and (p − 1)(q − 1) except for 1. In other words two numbers e and (p – 1)(q – 1) are coprime.

Calculate the private key d , where 1 < d < (p - 1)(q - 1) and d * e = 1 mod ((p - 1)(q - 1))       Or, d = e-1 mod ((p - 1)(q - 1))

RSA Encryption
Suppose the sender wish to send some text message to someone whose public key is (n , e). The sender then represents the plaintext message as a positive integer m which less than n.
Computes the ciphertext as C = me mod n.

RSA Decryption
The receiver uses his private key (n , d) to compute m and extracts the plaintext from it.
(m = Cd mod n)

Example -

Select two prime numbers, p = 7 and q = 17
Calculate n = p * q = 7 * 17 = 119 and (p - 1)(q - 1) = (7 - 1)(17 - 1) = 6 * 16 = 96
Let e = 5 So, d = 77       [ (77 * 5) mod 96 = 1 ]
Therefore the public key is = [119, 5] and the private key is = [119, 77]

Encryption -
Let m = 19 [plaintext message]
So the cipher text C = (me mod n) = (195 mod 119) = (2476099 mod 119) = 66

Decryption -
m = (Cd mod n) = (6677 mod 119) = 19

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.

MORE TOPIC

WHAT WE DO

 Follow Us 