Uploaded by riya suthar

RSA Algorithm[1]

advertisement
RSA Algorithm
Practical : - 1
Outcomes
Working of RSA algorithm
Example
4/26/2023
PRESENTATION TITLE
2
Introduction
RSA algorithm is an asymmetric cryptography algorithm. RSA stands for Rivest – Shamir – Adleman.
The idea of RSA is based on the fact that it is difficult to factorize a large integer. The public key consists of
two numbers where one number is a multiplication of two large prime numbers. And private key is also
derived from the same two prime numbers. So if somebody can factorize the large number, the private key
is compromised. Therefore encryption strength totally lies on the key size and if we double or triple the key
size, the strength of encryption increases exponentially. RSA keys can be typically 1024 or 2048 bits long.
4/26/2023
PRESENTATION TITLE
3
RSA Alogrithm
4/26/2023
PRESENTATION TITLE
4
Working of
RSA Algorithm
Key Generation
Select p,q
(p and q both prime)
Calculate n = p*q
Calculate φ(n) = (p - 1) * (q - 1)
4/26/2023
Select integer e
gcd(φ(n),e)=1; 1 < e < φ(n)
Calculate d
d = e mod φ (n) = 1
Public Key
KU = {e,n}
Private Key
KR = {d,n}
PRESENTATION TITLE
6
Encryption
4/26/2023
Plaintext
M<n
Ciphertext
C = me mod n
PRESENTATION TITLE
7
Decryption
4/26/2023
Ciphertext
C
Plaintext
M = cd mod n
PRESENTATION TITLE
8
Example of
RSA Algorithm
Example
Select p = 3 and q = 11 (both are prime numbers)
Calculate n = p*q = 3 * 11 = 33.
Calculate φ(n) = (p-1).(q-1) = 2 x 10 = 20.
Select e such that e is relatively prime to φ(n) = 20 and less than φ(n) we choose e = 7.
Determine d such that d = e mod φ (n) = 1 ( d= e (mod 20) and d < 20.
The resulting keys are public key PU = {7,33} and private key PR = {3,33}.
The example shows the use of these keys for a plaintext input of M = 9.
For encryption, we need to calculate C.
RSA Algorithm
10
Example
C = me mod n
= 5 ^7 mod 33
= 3380 mod 33
= 14
M = cd mod n
= 14^3 mod 33
= 2744 mod 33
=5
RSA Algorithm
11
Thank you
Aayushi Patel
Enrollment : 206140316022
Semester 6th
Department : IT
Download