Calculate (baseexponent) mod modulus efficiently using fast exponentiation algorithms. Essential for cryptography and number theory.
Modular exponentiation is the computation of be mod m, where b is the base, e is the exponent, and m is the modulus. It is a fundamental operation in number theory and cryptography.
Why modular exponentiation is important:
This algorithm reduces the number of multiplications from O(n) to O(log n) by using the binary representation of the exponent.
Processes the binary digits of the exponent from least significant to most significant.
Processes the binary digits of the exponent from most significant to least significant.
| Property | Formula | Example |
|---|---|---|
| Modular Multiplication | (a × b) mod m = [(a mod m) × (b mod m)] mod m | (7 × 9) mod 5 = 3 |
| Modular Exponentiation | ab mod m = (a mod m)b mod m | 73 mod 5 = 23 mod 5 = 3 |
| Exponent Rules | ab+c = ab × ac | 23+4 = 23 × 24 = 8 × 16 = 128 |
| Exponent Rules | ab×c = (ab)c | 23×2 = (23)2 = 82 = 64 |
| Fermat's Little Theorem | If p is prime and a not divisible by p: ap-1 ≡ 1 (mod p) | 36 mod 7 = 1 |
| Euler's Theorem | If gcd(a, n) = 1: aφ(n) ≡ 1 (mod n) | 56 mod 9 = 1 (φ(9)=6) |
RSA uses modular exponentiation for both encryption and decryption:
Allows two parties to establish a shared secret over an insecure channel:
Digital Signature Algorithm uses modular exponentiation for signature generation and verification:
Calculator Features:
713 mod 11
= 2
210 mod 1000
= 24
3200 mod 50
= 1
523 mod 13
= 8
123456 mod 789
= 699
6553765537 mod (109+7)
= 926181364