The RSA Algorithm: Easy Mechanics of Encryption and Decryption

RSA algorithm is a public key algorithm. It falls in the category of asymmetric cryptographic algorithm. It uses two keys private and public. The public key is known to all users in the network while the private key is kept secret and not shareable to all. It is named on its creates names -Rivest, Shamir and Adleman. It is based on the principle that it is easy to multiply two prime numbers but it is very hard to factor the product and get them back. This algorithm came into existence in the year 1977. The algorithm  works in the following mentioned steps:

Step1. Take two large prime numbers. Let them consider A and B, they should be of equal length. Now obtain their product(N).

         Therefore, N=A*B

Step 2. Subtract 1 from both and take their product as T

         Therefore, T=(A-1)*(B-1)

 Step 3. Choose the public key(E) which is a randomly chosen number such that it has no common factor with T.

 Step 4.Acquire the private key(D) as mentioned below:

        D = E-1 mod T

Step5. The rule  for encrypting the block of plaintext M into cyphertext is as under:

      C = Me mod N

This equation tells plaintext that M is raised to the power of E(public key) and then divided by N. The mod term equation mentioned in the fifth step indicates that the remainder of this division is sent as ciphertext C.

Step 6. Now the message which will be received from C at the receiver is decrypted to get the plaintext back by using the following equation:

M= CD mod N

The overall encryption and decryption algorithm is illustrated in the below diagram:

RSA Algorithm

Security of RSA

The RSA algorithm provides better security as it uses a large number of prime numbers A and B . And it is arduous even for a faster computer to break the code and to predict the product of prime numbers A and B. However as the computer improves with the passage of time, it decreases the time require to break the code. As a result, it also required to use of larger keys. However, then the time needed for encryption and decryption will also increase. The personal use key size is 768 bits . The key size for corporate usage is 1024 bits and 2048 bits for extremely valuable keys.

Example to Explain RSA algorithm

Select suitable values of A ,B,N,D and demonstrate the encryption and decryption procedures used in the RSA algorithm.

Select Two Prime Numbers

Let the two prime numbers A and B. Consider A=11 and B=23.

Evaluate N and T

N=A*B=11*23=253

T=(A-1)*(B-1)=10*22=220

Evaluate Public key (E) and Private key (D)

E(Public key ) should not have any factor other than 1 in common with T i.e. 220.

Thus, 220=2*2*55=2*2*5*11

Hence we can choose E=3

Now calculate D with the help of the following syntax:

D = E-1 mod T

Therefore,D = 3-1 mod 220

Next, we find the (multiple of 220+1)which is divisible by 3. Then we divide that number by 3 and select the quotient of this division as D.

Therefore ,(220*1)+1=220 not divisible by 3

(220*2)+1=441 not divisible by 3

Therefore, 441/3=147

or D=147

Carryout Encryption

Consider the letter 1 is to sent.

Therefore plaintext M=9,as F is the ninth alphabet.

Hence,    Ciphertext C=Me mod N

C=93 mod 221

Hence,C=729mod 221

orC=729/221

Q=3 remainder =66

Therefore Ciphertext C=66

Now, this number is sent to the receiver.

Carryout Decryption

Finally, let us calculate the decryption

Plaintext M= CD mod N=66147 mod 221=9.

Thus the original number is obtained.

Also check: How to Save All Outlook Emails to External Hard Drive?

Advantages RSA Algorithm

  • No need of sharing secret keys.
  • Proof of owner’s authenticity.
  • Faster encryption than DSA.
  • Data can’t be modified in transit.

FAQ

Q1.The RSA Signature Uses which Hash Algorithm?

Ans. The md5 and sha-1 hash is concatenated together and then encrypted with the server’s private key.

Q2.Which algorithm is used for decrypting the RSA algorithm?

Ans. Using the private key, which is the opposite of the public key used for encryption, the RSA algorithm is decoded. The encrypted message’s modular inverse, which yields the original message, is computed using the private key. Modular exponentiation, a technique for breaking an RSA encryption, entails first raising the encrypted message to the power of the private key and then reducing it to modulo the modulus.

Q3.On what factors does the security of the RSA algorithm depend?

Ans. The RSA algorithm’s security mostly depends on how challenging it is to factor huge integers and compute the modular inverse. The RSA encryption is regarded as secure if the modulus employed in it is a sizable prime integer and its factorization is impractical. The security of the RSA technique is further influenced by the size of the modulus, the length of the key, and the robustness of the random number generator used to produce the primes.

Sharing Is Caring:

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock