As we’ve learned in a previous section, substitution ciphers require a mapping between a plaintext letter and a corresponding ciphertext letter. There are numerous ways to map a plaintext letter to a ciphertext letter, and we’ll see the more mathematics you know the more secure a system you’ll be able to devise. To start, we’ll focus on monoalphabetic substitution ciphers.
We call this mono alphabetic because there’s one and only one ciphertext alphabet for each plaintext alphabet. We’ll see later on in the course that there are encryption schemes that use multiple ciphertext alphabets when enciphering a message.
This chapter starts with general substitution, where any scrambled alphabet can be the key. Then it builds ciphers whose mapping comes from arithmetic on the letters’ positions: the Caesar (additive) cipher, the multiplicative cipher and the affine cipher. Along the way you’ll learn the modular arithmetic these ciphers need, and the Euclidean algorithm, which tells you which multiplicative keys work and how to undo them. The chapter ends with the Atbash cipher, an ancient cipher that turns out to be a special affine cipher.
In This Chapter¶
Any rearrangement of the alphabet can be the key, which gives keys.
Shift every letter the same number of places down the alphabet.
Clock arithmetic, so a shift past z wraps around to the start.
The Caesar cipher as a formula, and deciphering by adding.
Multiply instead of add, and find out why only 12 keys work.
Find greatest common divisors and multiplicative inverses without factoring.
Multiply, then add. That gives 312 keys.
An ancient cipher that turns out to be an affine cipher.