Modular Exponentiation
Context: FIT1058_MOC · computing fast · square-and-multiply via binary exponent · exponent reduced by Euler’s theorem
Quick Revision
- 🎯 Objective: compute efficiently ➔ square-and-multiply, multiplications.
- 📦 Core Components: binary exponent ➔ reduce mod each step ➔ reduce exponent mod .
- ⚡ Key Constraint: easy forward, discrete-log inverse is hard — the One-Way Function basis.
📝 Core
1. Fast Exponentiation
- Naïve ➔ multiplications.
- Square-and-multiply ➔ write in binary, repeatedly square ⟹ .
- Bound ➔ at most multiplications.
2. Three Savings
- Fewer multiplications ➔ squaring cuts .
- Small factors ➔ reduce mod each step.
- Smaller exponent ➔ if (Euler’s Theorem and Fermat’s Little Theorem).
3. One-Wayness
- Easy ➔ modular exponentiation.
- Hard ➔ inverting it (discrete logarithm) ➔ powers Diffie-Hellman Key Agreement.
Key identities:
⚖️ Core Decision Matrix
| Trick | Effect | Cost |
|---|---|---|
| square-and-multiply | mults | binary exponent |
| reduce mod | keep factors | per step |
| reduce exp mod | shrink | needs |
When It Flips: three independent savings — fewer multiplications, smaller products, smaller exponent. Modular exponentiation is the workhorse of public-key cryptography precisely because it is easy forward but hard to invert (discrete log).
📊 Exam Execution Trace
Manual Execution Trace
, :
| Step / State | Power | Value mod 11 |
|---|---|---|
| 0 (Init) | 7 | |
| 1 | 5 | |
| 2 | 3 | |
| 3 | 9 |
⚠️ Common Mistakes
- 💡 Exponent reduction needs coprimality ➔ requires ; without it the shortcut can fail. Reduce mod at every step to keep numbers small.
🧠 Active Recall
How does square-and-multiply compute in 6 multiplications, and the general bound?
- Hint: Binary exponent.
Answer
- Short answer: ; five squarings () + one multiply, vs 35 naïvely.
- Why: ➔ at most multiplications.
Give the two further tricks for using .
- Hint: Reduce products and exponent.
Answer
- Short answer: Reduce each product mod 25; reduce exponent mod ⟹ .
- Why: Coprimality ➔ exponent reduction valid since .