Rsa Calculator
Calculate RSA encryption parameters: generate public/private keys, encrypt and decrypt messages using prime numbers.
Was this calculator helpful?
How to use this tool?
This RSA calculator demonstrates the core encryption algorithm. Follow these steps:
- Enter two distinct prime numbers (p and q). For example, 61 and 53. These must be prime numbers ≥ 2.
- Set a public exponent (e). Default is 65537. It must be coprime to φ(n) and 1 < e < φ(n).
- Enter a message as a non-negative integer (e.g., 42). This is the plaintext number.
- Click "Calculate". The calculator will validate inputs and compute:
- n = p × q (modulus)
- φ(n) = (p-1) × (q-1) (Euler's totient)
- Public key = (n, e)
- Private key d = modular inverse of e modulo φ(n)
- Encrypted message = me mod n
- Decrypted message = encryptedd mod n (should match original message)
Note: All values must be integers. For security, use large primes in practice; this tool uses small numbers for learning. The decrypted message should equal your original input if calculations are correct.
Previous Results
| Result | Inputs | Date |
|---|
Frequently Asked Questions
RSA is an asymmetric encryption algorithm that uses a pair of keys: a public key for encryption and a private key for decryption. It relies on the difficulty of factoring large prime numbers.
Common choices are 65537 (2^16+1) or 17. It must be coprime to φ(n) and 1 < e < φ(n). The calculator validates this.
The message must be a non-negative integer less than n. For longer messages, use a larger n or split the message.