RSA Encryption / Decryption
A browser-based, educational RSA lab: generate small demo keys, encrypt a short message with the public key, and decrypt with the private key. Good for learning the algorithm, not for real-world security.
⚠️ Educational only — uses small primes and naïve randomization. Do not send secrets.
1. Generate / enter keys
Click “Generate demo keys” to let the tool pick two primes and compute n, φ(n), e and d. Or paste your own n, e, d below.
2. Encrypt
We convert your message to UTF-16 code units and encrypt each unit separately: simple, visible, educational.
Ciphertext (array of big integers):
3. Decrypt
Paste the ciphertext array exactly as produced above, then decrypt with the private key d.
Decrypted message:
How RSA works (short)
RSA is based on modular arithmetic and the difficulty of factoring a large number \( n = p \times q \):
1. Choose two primes p, q
2. n = p · q
3. φ(n) = (p − 1)(q − 1)
4. Choose e s.t. 1 < e < φ(n) and gcd(e, φ(n)) = 1 (common: 65537)
5. Compute d ≡ e⁻¹ (mod φ(n))
6. Public key = (n, e), Private key = (n, d)
To encrypt a number \(m\): \( c = m^e \bmod n \). To decrypt: \( m = c^d \bmod n \).
Note: Real implementations use padding schemes (like OAEP) and big key sizes (2048+ bits). This page is intentionally simplified.
Formula (LaTeX) + variables + units
','\
1. Choose two primes p, q 2. n = p · q 3. φ(n) = (p − 1)(q − 1) 4. Choose e s.t. 1 < e < φ(n) and gcd(e, φ(n)) = 1 (common: 65537) 5. Compute d ≡ e⁻¹ (mod φ(n)) 6. Public key = (n, e), Private key = (n, d)
- No variables provided in audit spec.
- NIST — Weights and measures — nist.gov · Accessed 2026-01-19
https://www.nist.gov/pml/weights-and-measures - FTC — Consumer advice — consumer.ftc.gov · Accessed 2026-01-19
https://consumer.ftc.gov/
Last code update: 2026-01-19
- Initial audit spec draft generated from HTML extraction (review required).
- Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
- Confirm sources are authoritative and relevant to the calculator methodology.