What is RSA Encryption?
RSA (Rivest-Shamir-Adleman) is one of the first public-key cryptosystems and is widely used for secure data transmission. It relies on the mathematical difficulty of factoring the product of two large prime numbers. RSA involves a public key (for encryption) and a private key (for decryption).
How RSA Works
1. Key Generation
Choose two primes p and q. Compute n = p*q and phi(n) = (p-1)(q-1). Choose e coprime with phi(n), find d such that e*d = 1 mod phi(n).
2. Encryption
Convert the message to a number m. Compute ciphertext c = m^e mod n using the public key.
3. Decryption
Compute original message m = c^d mod n using the private key.
Security of RSA
The security of RSA relies on the practical difficulty of factoring the product of two large prime numbers. In real-world applications, RSA typically uses key sizes of 2048 or 4096 bits. This calculator uses small primes for demonstration purposes only.
Important Concepts
- Euler's Totient Function: phi(n) counts integers less than n that are coprime with n.
- Modular Exponentiation: Efficiently computing large powers modulo n.
- Extended Euclidean Algorithm: Used to find the modular inverse d of e.
- Coprime: Two numbers are coprime if their GCD is 1.