Primer

Volume VII · 01 · Mod

01 · The clock

Mod

All of public-key crypto is arithmetic that wraps. A clock with n hours. Exponentiation stays on the face. The secret is how many turns you took.

In English

Modular arithmetic is clock math. 10 + 3 on a 12-hour clock is 1. All of public-key crypto is this clock with a huge number of hours. You see where the hand is. You are not supposed to see how many full turns it took.

Try this
Set n = 12. Hit +1, then ×2. The hand wraps. That wrap is the whole playground.
Keep this
mod n means “remainder after wrapping the clock.”

Lab · a clock with n hours

01234567891011

4 (mod 12)

a mod n is the remainder. A clock with n hours. Addition and multiplication wrap; they never leave the face. Exponentiation is just multiplication, repeated, still on the face.

“Hard” in this volume always means: you see the hand, you do not see the number of turns. That is the discrete log, and it is why wrapping is not a gimmick.