Math 203: Caesar cipher

In class we talked about “the” Caesar cipher, in which the letters of a message are encoded by shifting them three places forward in the alphabet (so A becomes D, B becomes E, C becomes F, …, W becomes Z, X becomes A, Y becomes B, and Z becomes C). To decode an encoded message, you just undo the encoding by shifting the letters back three places.

This idea can easily be generalized. Instead of shifting letters three places forward, we can shift them seven letters forward, for example (so A becomes H, B becomes I, C becomes J, and so on); or we could shift them two letters back (so A becomes Y, B becomes Z, C becomes A, and so on); or we could use any other shift amount. Each different shift amount will give us a different Caesar cipher. Since there are 26 letters in the alphabet, we can get 25 different Caesar ciphers (because one of the possibilities, shifting letters 26 places forward, isn’t a very effective code).

(Note that when we create a code this way and encode a message, we pick the shift amount at the beginning, but then we stick with our choice for the whole message. No fair changing shift amounts in the middle of the message—that would be a more complicated code.)

Here is a randomly selected message encoded with a Caesar cipher using a randomly chosen shift amount:

PSK SNKJCO ZKJ’P IWGA W NECDP, XQP PDNAA HABPO ZK

Can you decipher this message? Explain how you figured it out. Research the history of the Caesar cipher and the codebreaking technique called frequency analysis. How does frequency analysis work?


Back to the Math 203 page

Last updated 14 February 2009. Brian Kell <s-bkell1@math.unl.edu>