Advanced

RSA Calculator — Key Generation, Encrypt & Decrypt

Enter two prime numbers p and q, a public exponent e, and an integer message m to see RSA key generation and encryption/decryption worked out step by step.
A prime number, e.g. 61
A different prime, e.g. 53
Must be coprime to λ(n); common value: 65537
Integer to encrypt; must be less than n = p × q
Ciphertext c
2,790

Encrypted message: c = m^e mod n

Modulus n = p × q
3,233
λ(n) = lcm(p−1, q−1)
780
Public key (n, e)
(3,233, 17)
Private key (n, d)
(3,233, 413)
Ciphertext c
2,790
Decrypted (verify)
65
RSA key generation & round-trip
1

Compute modulus n = p × q

n = 61 × 53 = 3233
2

Compute Carmichael totient λ(n) = lcm(p−1, q−1)

λ(n) = lcm(60, 52) = 780
3

Public exponent e (must be coprime to λ(n))

e = 17, gcd(17, 780) = 1 ✓
4

Private exponent d = e⁻¹ mod λ(n)

d = 17⁻¹ mod 780 = 413
5

Encrypt: c = m^e mod n

c = 65^17 mod 3233 = 2790
=

Decrypt: m = c^d mod n

m = 2790^413 mod 3233 = 65
Step by step
  1. 1

    Modulus n = p × q

    61 × 53 = 3,233
  2. 2

    Carmichael totient λ(n) = lcm(p−1, q−1)

    lcm(60, 52) = 780
  3. 3

    Private exponent d = e⁻¹ mod λ(n)

    17⁻¹ mod 780 = 413
    Computed via the extended Euclidean algorithm.
  4. 4

    Ciphertext c = m^e mod n

    65^17 mod 3,233 = 2,790
परिणाम केवल सामान्य जानकारी के लिए अनुमान हैं और पेशेवर सलाह नहीं हैं — महत्वपूर्ण परिणामों पर भरोसा करने से पहले हमेशा उन्हें स्वतंत्र रूप से सत्यापित करें। पूरा अस्वीकरण पढ़ें.
त्वरित उत्तर

यह कैलकुलेटर कैसे काम करता है?

RSA key generation: pick primes p, q → n = p·q, λ(n) = lcm(p−1,q−1), choose e coprime to λ(n) → d = e⁻¹ mod λ(n). Public key = (n,e), private key = (n,d). Encrypt m: c = m^e mod n. Decrypt: m = c^d mod n. All arithmetic uses fast binary exponentiation and BigInt for exactness.

सूत्र
n = p·q • λ(n) = lcm(p−1, q−1) • d = e⁻¹ mod λ(n) • Encrypt: c = mᵉ mod n • Decrypt: m = cᵈ mod n
How this is calculated

RSA (Rivest–Shamir–Adleman, 1977) is the most widely deployed public-key cryptosystem. Security rests on the computational difficulty of factoring the product of two large primes. The key generation steps are: (1) choose two distinct primes p and q; (2) compute the modulus n = p × q; (3) compute Carmichael's totient λ(n) = lcm(p−1, q−1) — the modern standard, preferred over Euler's φ(n) = (p−1)(q−1) because it produces a smaller private exponent; (4) choose a public exponent e with 1 < e < λ(n) and gcd(e, λ(n)) = 1 — 65537 is the near-universal choice in practice because it is prime, coprime to almost all λ(n) values, and has a short binary representation that speeds modular exponentiation; (5) compute the private exponent d as the modular inverse of e modulo λ(n) via the extended Euclidean algorithm.

Encryption takes integer message m (0 ≤ m < n) and computes ciphertext c = m^e mod n using fast binary exponentiation. Decryption recovers the message as m = c^d mod n. The round-trip works because e and d are modular inverses: m^(e·d) ≡ m (mod n) by the Carmichael theorem.

This calculator uses JavaScript BigInt for exact arithmetic and is designed for educational use with small primes. Real RSA uses primes of 1024–4096 bits; this tool limits p and q to 1 000 000 to keep computation instant in the browser. A textbook RSA encrypt of a raw integer is also not semantically secure without proper padding (OAEP in production). The step-by-step panel shows every intermediate value so you can follow the algorithm by hand.

अक्सर पूछे जाने वाले प्रश्न

The private key d is the modular inverse of e modulo λ(n). A modular inverse exists if and only if gcd(e, λ(n)) = 1. Without this, decryption is impossible. Common safe choices are e = 3, 17, or 65537.

65537 = 2^16 + 1 is prime, so gcd(65537, λ(n)) = 1 for almost any choice of p and q. Its binary form (10000000000000001) has only two 1-bits, making modular exponentiation with e extremely fast. It also prevents some small-exponent attacks.

No. Real RSA uses primes of 2048–4096 bits and mandatory padding schemes (OAEP). This calculator uses small primes for educational demonstration only — the keys it generates are trivially factorable and must never be used for real security.

APA

TG we-Calculate Editorial Team. (2026). RSA Calculator — Key Generation, Encrypt & Decrypt [Online calculator]. TG we-Calculate. https://we-calculate.com/hi/calculator/rsa-calculator

Chicago

TG we-Calculate Editorial Team. "RSA Calculator — Key Generation, Encrypt & Decrypt." TG we-Calculate. 2026. https://we-calculate.com/hi/calculator/rsa-calculator.

IEEE

TG we-Calculate Editorial Team, "RSA Calculator — Key Generation, Encrypt & Decrypt," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/hi/calculator/rsa-calculator

BibTeX

@misc{wecalculate_rsa_calculator, title = {RSA Calculator — Key Generation, Encrypt & Decrypt}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/hi/calculator/rsa-calculator}}, year = {2026}, note = {TG we-Calculate} }

क्या इस कैलकुलेटर ने आपकी मदद की?

संबंधित कैलकुलेटर