Modular Exponentiation
Core operation of RSA encryption — raise a message to a power, modulo n.
Formula
Variables
Example
m=4, e=3, n=33: c = 64 mod 33 = 31
How it works
Modular exponentiation means you take a message value, raise it to a chosen power, and then keep only the remainder after division by a modulus. In RSA, this is useful because it transforms the message in a way that is easy to compute with the public key, but much harder to reverse without the private key. The modulus keeps the numbers bounded, so the result always stays within a fixed range from 0 to n−1.
When to use it
Use this in public-key cryptography, especially RSA encryption and key-based protocols. It also appears in any problem involving powers under a modulus, such as fast modular arithmetic in number theory or computer security.
Worked example, step by step
Given m = 7, e = 4, n = 15 Step 1: Raise the message to the exponent: 7^4 = 2401 Step 2: Divide by the modulus and find the remainder: 2401 mod 15 Step 3: 15 × 160 = 2400, so the remainder is 1 Final answer: c = 1
Common mistakes to avoid
- Forgetting to take the remainder after exponentiation, not at the end
- Confusing the public exponent e with the modulus n
- Using ordinary division instead of modular reduction
Did You Know?
Fast exponentiation lets computers raise huge numbers to huge powers in milliseconds — the engine of public-key crypto.
Share this formula
More in Cryptography & Security
View allRSA Decryption
AdvancedRecovers the message using the private exponent d.
Euler's Totient
IntermediateCounts integers below n coprime to it, for n = pq — used to make RSA keys.
Shannon Entropy
AdvancedAverage information content — and the theoretical strength of a random source.
Password Entropy
IntermediateBits of security from password length and character-set size.
Key Space Size
IntermediateNumber of possible keys for a b-bit key.
Birthday Bound
AdvancedCollisions become likely after about √ of the hash space.