Euler Totient for RSA
Enter two primes p and q to compute φ(n), pick a public exponent e, and see the full RSA key generation process step by step.
Use the Euler Totient for RSA
Inputs
Must satisfy 1 < e < φ(n) and gcd(e, φ(n)) = 1
Quick examples
RSA Key Components
Totient Derivation
Extended Euclidean Algorithm — finding d
—| Step | a | b | q = ⌊a/b⌋ | r = a mod b | s | t |
|---|---|---|---|---|---|---|
| Compute to see steps. | ||||||
What the columns mean
At each displayed row, s and t are the coefficients of the current b: φ(n)·s + e·t = b. When the remainder reaches 0, the last nonzero row gives the Bézout coefficient for e; reducing it modulo φ(n) gives the private exponent d.
Summary
This tool computes Euler's totient function φ(n) = (p-1)(q-1) for two primes p and q, then derives a complete RSA key pair. It finds a valid public exponent e, computes the private exponent d using the extended Euclidean algorithm, and shows every intermediate step so you can follow the math used in real RSA implementations.
How it works
- Enter two distinct prime numbers p and q.
- The tool computes the RSA modulus n = p × q.
- Euler's totient is calculated as φ(n) = (p-1) × (q-1).
- A valid public exponent e is chosen: 1 < e < φ(n) with gcd(e, φ(n)) = 1.
- The private exponent d = e⁻¹ mod φ(n) is found via the extended Euclidean algorithm.
- The step-by-step table shows every division, quotient, and back-substitution used to find d.
Use cases
- Learn RSA key generation for a cryptography course.
- Verify hand-computed RSA homework answers.
- Understand why the extended Euclidean algorithm is used to find d.
- Debug a custom RSA implementation by checking intermediate values.
- Explore how small prime choices affect key size and security.
- Visualize the relationship between p, q, n, φ(n), e, and d.