RSA FOR BEGINNER

Hi there! we shall discuss about basics of RSA (Rivest Shamir Adelman) cryptosystem.
PRE-REQUISTES
- Understanding of Prime and Composite Numbers
- Euler’s Theorem (Number Theory)
- Modular Arithmetic
- Asymmetric-key algorithm
Introduction
RSA Cryptosystem is asymmetric-key algorithm, which means we will be using a set of keys known as public and private keys. Let’s dive into the working!
Principle
Let’s assume you want to encrypt a message M. Now you will generate a pair of public and private keys: (n and e) and (n and d) respectively.

N - Modulus, E - Public Exponent, D - Private Exponent
N is a product of primes, usually cryptanalysis of RSA depends on N of the RSA. The more difficult it is to factorize the N, the lesser is the possibility of being attacked.
NOTE: There are lot’s of cryptanalytic attacks which can be performed apart from factorizing N.
For sake of simplicity let’s take P and Q as some prime whose product is N.
N = P * Q
Encryption Formula
C ≡ M^e mod N
Decryption Formula
D ≡ C^d mod N
Encryption Process
- Generate modulus — N using prime numbers.
- Now generate larger random Public Exponent — e.
- Then use the Encryption formula to encrypt the message
Decryption Process
- To decrypt the ciphertext, we need to calculate Euler’s totient phi Φ.
- In our case Φ = (p -1) * (q-1)
- let’s calculate the private exponent — d. By finding the modular inverse of public exponent and Euler’s totient.
- Now we have the values needed for decryption of cipher text C.
Final Note
Hope you guys understood the mechanism of RSA Cryptosystem. RSA is strong cryptosystem but when implemented wrong it’s as weak as other cryptosystem too.
Fact: Quantum Computing is a upcoming threat for RSA cryptosystem, which can factorize any number very quickly compared to the current generation computers.
Hope you all liked it : P