RSA Calculator

Your details

First prime factor. Must be a prime number different from q.
Second prime factor. Must be a prime number different from p.
Public exponent. Must be coprime with lambda(n). 65537 is the standard choice in real cryptographic systems.
Integer to encrypt. Must be less than n.
Encrypted integer to decrypt. Leave 0 to use the auto-computed ciphertext.
Modulus n = p × qEducational key
3,233

Public modulus; part of both the public and private key.

lambda(n) = lcm(p-1, q-1)780
Public exponent e17
Private key d413
Encrypted C = M^e mod n2,557
Decrypted M = C^d mod n42
p is primeYes
q is primeYes
gcd(e, lambda(n))1
Public exponent e17
Private key d413
Ciphertext C2,557

RSA key pair generated successfully.

  • Public key: (n = 3233, e = 17). Share this freely.
  • Private key: (n = 3233, d = 413). Keep this secret - anyone with d can decrypt.
  • Message 42 encrypts to ciphertext 2557 using C = M^e mod n.
  • Decrypting ciphertext 2557 recovers 42 using M = C^d mod n.
  • In practice, RSA keys are 2048+ bits. These small primes are for learning the algorithm only.

Next stepTo send a message securely, publish your public key (n, e) and ask others to encrypt with it. Only you - holding d - can decrypt.

= Powered by OnlyCalculators