Crypto tools

Affine cipher decode

Affine cipher decode, classical cipher, a puzzle not a protection, computed on your device.

Runs on your device. The file is never uploaded.

Affine cipher decode inverts the multiplier a modulo 26, undoes the offset b, and returns letters with your spacing, digits and punctuation still in place. Both numbers default to the encoder values, 5 and 8. An a sharing a factor with 26 is refused for having no inverse, while a wrong b returns tidy nonsense and no warning.

Input

Options

Questions

What do I need to decode?

The same two numbers used to encode, a and b. The tool inverts a modulo 26 and reverses the offset. Without the pair you are guessing, and guessing is feasible here because only 312 keys exist.

Why did I get nonsense back?

Almost always a wrong a. Every valid key produces readable output only for the key that matches; any other pair returns letters that are correct arithmetic and meaningless text. Check that a is coprime with 26 and matches what was used.

Do I need to strip punctuation first?

No. Non-letters are passed through unchanged, in place, so you get the original spacing and punctuation back along with the decoded letters.

What if I do not know the key?

Try Caesar brute force first if you suspect a is 1, since that prints all 25 shifts at once. For a true affine key, the search space is small enough to work through by hand with letter frequencies.

Related Crypto tools