Skip to content
World 1 · Substitution · 7 min

Affine: multiply, then shift

E(x) = a·x + b (mod 26)

Teaching this? Open projector mode

Number the letters A=0 … Z=25. The affine cipher multiplies each number by a, adds b, and wraps round 26:

E(x) = (a·x + b) mod 26

The Caesar shift is the special case a = 1. Multiplying scatters the letters, so neighbours in the alphabet end up far apart.

Loading 3D lab…
Check yourself

How many values of a can be undone?

Check yourself

Why is a = 13 forbidden?

0 of 3 required activities complete. Finish each task and quiz.Next lesson →

Report a mistake

What is wrong?
0 / 2000 · at least 10 characters
Sent along with your report
  • Page
  • About Affine: multiply, then shift — Codes & Ciphers Lab · cryptography/affine
Plus your browser type. Reports go to our support system; see the privacy notice.