Affine — A linear map on letter positions: multiply by a, add b, reduce modulo 26. The multiplier must be coprime with 26 or the map is not reversible.
Linear map x -> a*x + b mod 26. Caesar is the special case a=1.
A worked example§
Encrypting a sample with the cipher itself, at build time:
MEET ME BY THE OLD CLOCK TOWER AT DAWN
Key: a=5, b=8
produces the ciphertext
QCCZ QC NY ZRC ALX SLASG ZAOCP IZ XIOV
This example is generated by running the cipher when the page is built, and the round trip is checked, so it always matches what the solver does.
How it is broken§
Twelve legal multipliers times twenty-six additions is 312 keys — an exhaustive sweep that takes milliseconds.
History and context§
The generalisation that makes Caesar (a = 1) and Atbash (a = 25, b = 25) the same cipher with different parameters.
See also§
Caesar (ROT-N) · ROT13 · Atbash · ROT47 · Reverse
Browse every cipher in the Shift and reciprocal alphabets family, read the history of codebreaking, or return to the wiki main page.
Frequently asked questions§
How is the Affine broken?
Twelve legal multipliers times twenty-six additions is 312 keys — an exhaustive sweep that takes milliseconds.
What key does the Affine use?
(a, b) pair. There are 312 possible keys.
How much ciphertext do I need?
At least 4 characters for this solver to attempt it; short messages can be readable and still not be proof.
Can I break a Affine on this page?
Yes — the browser solver on this page handles it directly. Paste the ciphertext into the solver and press the button.