RSA Encryption and Decryption Demo
Generated Keys:
Public Key (e,n): Loading...
Private Key (d,n): Loading...
Enter a message and click Start Demo
RSA Encryption Process
Step 1: Key Generation
Prime numbers chosen:
- p = 61
- q = 53
- n = p × q = 3,233
- φ(n) = (p-1)(q-1) = 3,120
- Public key (e) = 17
- Private key (d) = 2,753
Step 2: Convert "Hi" to ASCII
'H' → 72
'i' → 105
Step 3: Encryption
Formula: C = M^e mod n
For 'H' (72):
C1 = 72^17 mod 3233 = 2132
For 'i' (105):
C2 = 105^17 mod 3233 = 2715
Encrypted message: 2132,2715
Step 4: Decryption
Formula: M = C^d mod n
For first character (2132):
M1 = 2132^2753 mod 3233 = 72 → 'H'
For second character (2715):
M2 = 2715^2753 mod 3233 = 105 → 'i'
Decrypted message: "Hi"