Clear methods, worked examples and practical results.calcviento.com
☰

RSA Calculator

Your inputs

Calculated result

2790

Your result

Educational modular exponentiation only; not secure RSA

This calculator provides an estimate based on the entered values. Verify the assumptions and results before making decisions.

Intro

An RSA calculator helps make public-key cryptography easier to understand by turning unfamiliar mathematical expressions into manageable arithmetic. RSA uses two related exponents and a shared modulus to transform integers and recover them. The underlying calculations involve prime numbers, remainders, and modular inverses, but the basic process can be followed without advanced mathematics.

This guide begins with the meaning of each symbol, then explains how an educational RSA example is constructed and checked. You will learn why the prime factors matter, how a public exponent differs from a private exponent, and why modular exponentiation makes large powers manageable. The example uses deliberately small numbers for learning, not for protecting information. Actual secure RSA encryption requires substantially more than the bare calculations shown here.

About this result

How to use

Enter the requested values, then select Calculate to view the result.

Formula

The starting formulas are n = p × q and phi(n) = (p - 1) × (q - 1), provided p and q are distinct primes. The symbol phi(n) denotes Euler's totient, the number of positive integers not exceeding n that are relatively prime to n. For RSA key construction, e must satisfy gcd(e, phi(n)) = 1. The notation gcd means greatest common divisor.

The private exponent solves e × d ≡ 1 (mod phi(n)). This means an integer k exists such that e × d = 1 + k × phi(n). The extended Euclidean algorithm is a systematic method of finding d.

A positive representative of the inverse can be chosen for convenient calculations. The basic RSA forward operation is c = m^e mod n, with 0 <= m < n. The inverse operation is m = c^d mod n.

An expression such as 7^3 mod 55 means cube seven, obtaining 343, and then take the remainder after division by 55. Since 343 = 6 × 55 + 13, the result is 13. For larger exponents, calculate successive squares and reduce every result modulo n.

Multiplication of the selected residues then produces the answer without constructing the full power. These formulas demonstrate textbook RSA arithmetic. They do not, by themselves, provide a secure encryption format.

Worked example

Consider a small RSA example with p = 5 and q = 11. Both are prime and they are distinct. First calculate the modulus: n = 5 × 11 = 55. Then calculate the totient: phi(n) = (5 - 1)(11 - 1) = 4 × 10 = 40.

Choose the public exponent e = 3. Since gcd(3, 40) = 1, it has an inverse modulo 40. The inverse is d = 27 because 3 × 27 = 81 = 2 × 40 + 1.

The public pair is therefore (55, 3), and the corresponding private exponent is 27. Let the message representative be m = 7. It falls within the required range from 0 to 54.

Encryption gives c = 7^3 mod 55 = 343 mod 55 = 13. Thus the ciphertext representative is 13. To check the inverse operation, compute 13^27 mod 55 using repeated squaring.

The successive residues are 13^2 mod 55 = 4, 13^4 mod 55 = 16, 13^8 mod 55 = 36, and 13^16 mod 55 = 31. Since 27 = 16 + 8 + 2 + 1, multiply the residues 31, 36, 4, and 13 modulo 55. First 31 × 36 mod 55 = 16.

Then 16 × 4 mod 55 = 9. Finally, 9 × 13 mod 55 = 7. The recovered integer is exactly the original message, 7. This example demonstrates arithmetic correctness, not practical cryptographic security.

Understand the calculation

RSA is named after Ron Rivest, Adi Shamir, and Leonard Adleman. Its central idea is that a public mathematical operation can be paired with a private operation that reverses it when the parameters are constructed correctly. In a simplified demonstration, the process starts by selecting two distinct prime numbers, usually called p and q.

Their product is the modulus n. A prime number is a positive integer greater than one with exactly two positive divisors: one and itself. Choosing distinct primes makes it possible to compute Euler's totient for their product as (p - 1)(q - 1).

Next, a public exponent e is selected so that it has no common factor greater than one with the totient. A private exponent d is then found such that multiplying e by d leaves a remainder of one when divided by the totient. The public pair (n, e) defines the basic forward operation. The private exponent d defines its mathematical inverse when used with the modulus.

A message in this model is not automatically a sentence or document. It is an integer m in the interval from zero through n - 1. The operation m^e mod n produces a ciphertext representative c. Applying c^d mod n recovers the original message representative.

The remainder operation is what keeps intermediate numbers within a manageable range when efficient algorithms are used. Every value in this explanation is a dimensionless integer. There are no meters, seconds, percentages, or decimal rounding rules involved.

If a person wants to encrypt ordinary text, a separate encoding and secure encryption scheme are necessary. Because the supplied calculator engine has not been verified, this guide does not assume specific input boxes, automatic prime checks, generated keys, or output formatting. The purpose is to explain the mathematics that an RSA modular-exponentiation demonstration is intended to illustrate.

Questions

What does an RSA calculator actually calculate?

An educational RSA calculator generally concerns relationships between prime factors, a modulus, exponents, and modular powers. Depending on its implementation, it may illustrate key arithmetic, forward transformations, inverse transformations, or selected parts of that process. The precise functions of this calculator have not been verified.

Why are two prime numbers used in RSA?

Two distinct primes allow the modulus to be formed by multiplication while providing a convenient formula for its totient. Their mathematical properties support construction of the inverse exponent. Real RSA key generation also requires careful procedures beyond simply selecting two small primes.

What is the difference between the public and private exponents?

The public exponent e participates in the forward modular-power operation, while the private exponent d participates in the corresponding inverse operation. They are related by modular inversion using the key's number-theoretic parameters. The private exponent must remain protected in real cryptographic use.

What does mod mean in an RSA formula?

Mod means taking a remainder after division by a positive modulus. For example, 17 mod 5 equals 2 because 17 is three complete groups of five with two left over. RSA applies this same remainder idea to powers of integers.

Can this example encrypt an ordinary written message?

Not directly. The worked example operates on a single integer, not a sequence of letters or bytes. Real message encryption needs an established representation and an appropriate secure encoding scheme. Simply replacing letters with numbers and applying textbook RSA is not a secure solution.

Are small RSA keys secure if the calculation works?

No. Correct mathematical reversal does not establish security. Small moduli can be factored readily, exposing the relationship needed to recover the private exponent. The small values shown here are useful precisely because their operations can be inspected manually rather than hidden inside large computations.