Chapter 14 – Modular Arithmetic and the Multiplicative Cipher 197
The multiplicative and affine ciphers are similar to the Caesar cipher, except instead of adding a
key to a symbol’s index in a string, these ciphers use multiplication. But before we learn how to
encrypt and decrypt with these ciphers, we’re going to need to learn a little math. This knowledge
is also needed for the last cipher in this book, the RSA cipher.
Oh No Math!
Don’t let it scare you that you need to learn some math. The principles here are easy to learn from
pictures, and we’ll see that they are directly useful in cryptography.
Math Oh Yeah!
That’s more like it.
Modular Arithmetic (aka Clock Arithmetic)
This is a clock in which I’ve replaced the 12 with a 0. (I’m a programmer. I think it’s weird that
the day begins at 12 AM instead of 0 AM.) Ignore the hour, minute, and second hands. We just
need to pay attention to the numbers.
Figure 14-1. A clock with a zero o’clock.