Demonstrate RSA arithmetic for small classroom examples by calculating the modulus, totient, and private exponent.
Educational only, not for real cryptography. This toy calculator validates small prime inputs and demonstrates the RSA arithmetic. It does not generate secure random primes, protect secret values, or produce production-ready keys. Use a vetted cryptographic library for real encryption or authentication.
Last updated: March 2026 | Cryptography Tool (Educational)
RSA (Rivest–Shamir–Adleman) is one of the most widely used asymmetric (public-key) encryption algorithms. It's based on the mathematical difficulty of factoring large integers into their prime factors. RSA uses two keys: a public key for encryption and a private key for decryption.
The security of RSA depends on the difficulty of determining the private key from the public key. The larger the key size (typically 2048 or 4096 bits), the harder it is to crack. This calculator uses small primes for educational purposes and should never be used for actual security applications.
The security of RSA relies on the difficulty of factoring n back into its prime factors p and q. With large primes (hundreds of digits), this factorization is computationally infeasible even for modern computers. Finding the prime factors is the "hard problem" that protects the key.
φ(n) counts how many integers from 1 to n are coprime with n (share no common factors). For two distinct primes p and q: φ(n) = (p-1)(q-1). This function is critical to RSA key generation and ensures the mathematical properties needed for encryption.
For encryption and decryption to be inverse operations, e and φ(n) must be coprime (share no common factors). If gcd(e, φ(n)) ≠ 1, then a unique modular inverse d doesn't exist, and the decryption won't work. This is a requirement of modular arithmetic.
Absolutely not for real applications. This calculator is educational only. Real-world RSA uses 2048-bit or 4096-bit keys (primes with 600+ digits). Small keys like these examples are trivially breakable—modern computers can factor them in seconds.
Related Tools
Check password security.
Calculate password strength.
Calculate possible passwords.
Encode with Caesar cipher.
Linear Feedback Shift Register.
Generate error correction codes.