Ins 9
Ins 9
PRACTICAL: 09
THEORY:
❖ What is RSA Algorithm? :
• The RSA algorithm is a widely used public-key
cryptosystem that enables secure data transmission. It was
developed by Ron Rivest, Adi Shamir, and Leonard
Adleman in 1977. RSA is based on the mathematical
properties of prime numbers and the difficulty of factoring
large composite numbers. It uses two keys: a public key for
encryption and a private key for decryption. The encryption
process involves raising the message to the power of the
public key, and decryption requires using the private key.
RSA ensures data confidentiality and is used in various
applications like secure communication, digital signatures,
and online transactions.
❖ Steps:
1) Select two prime number p and Q
p= 3 q=11
2) Calculate n=p*q
n=3*11=33
3) Calculate Φ(n)=(p-1)*(q-1)
Φ(n)=(3-1)*(11-1)=2*10=20
8) P= c^d mod n
Decryption = c^d mod 33
=29^3 mod 33
=2
CODE:-
e, n = public_key
return [pow(ord(char) - ord('A'), e, n) for char in message]
Output: