RSA Algorithm

The algorithm was published in the 70’s by Ron Rivest, Adi Shamir, and Leonard Adleman.

The RSA algorithm holds the following features −

  • RSA algorithm is a popular exponentiation in a finite field over integers including prime numbers.
  • The integers used by this method are sufficiently large making it difficult to solve.
  • There are two sets of keys in this algorithm: private key and public key.

Steps 1. Select two prime numbers , I will pick 2 and 7 , lets call them p and q where
P = 2 and Q = 7

Step 2. Multiply P and Q to get modulus n = P * Q = 14

Step 3. Calculate L = (p-1)*(q-1) where l is count of all non common factors between 1 and 14.

L=[2,3,4,5]

Step 4: select a derived Number (e) which is Coprime with L (6) = L=[2,3,4,5] and the Modulus N= (14) , the answer is 5 , there’s no other possibility .

Step 5: Formulate the Public key
The specified pair of numbers n and e forms the RSA public key and it is made public as (e,N) i.e. (5,14).

Step 6: Formulate the Private Key

Private Key d is calculated from the numbers p, q and e. The mathematical relationship between the numbers is as follows −

ed mod (p-1) (q-1) = 1

5d mod 6 = 1

d = 11

Hence, (d,n) = (11,14)


Let’s suppose p is the plaintext and c is ciphertext then:

Encryption Formula

Consider a sender who sends the plain text message to someone whose public key is (n,e). To encrypt the plain text message in the given scenario, use the following syntax −

C = Pe mod n

Decryption Formula

The decryption process is very straightforward and includes analytics for calculation in a systematic approach. Considering receiver C has the private key d, the result modulus will be calculated as −

Plaintext = Cd mod n


Exclusively available

on

Google Play Book