Shift Ciphers

The other week I guest taught a lesson on encryption. I only had about 30 minutes, so I couldn’t cover all of what I had written. Here is most of what I wrote. I hope my \LaTeX code compiles correctly.

 

Caesar Cipher or Fdhvdu flskhu

Encryption allows us to send messages to each other without others knowing what that message is. Here we will explore one of the most basic, yet unsecure types of ciphers, the Caesar Cipher.

To encrypt a message using the Caesar cipher we begin by placing two alphabets on top of one another. The top (lower-case) line will be our plain text, the bottom will be our cipher text.

Plain Text: the sly fox jumped over the lazy dog

shift

Without the letters shifted there would be absolutely no encryption because each letter in the plain text corresponds to the same letter in the cipher text. To scramble the message we need to shift the bottom row of letters over.

Let’s begin by doing a shift of 3.

shift3

Notice how when I run out of letters after “Z” I just restart the alphabet.

Cipher Text WKH VOB IRA MXPSHG RYHU WKH ODCB GRJ

In order to decrypt the message all we do is use the same shift, but go up towards the plain text instead of going down towards the cipher text.


You Try: Encrypt the message with a shift of 4.

I want some icecream.

A: M AERX WSQI MGIGVIEQ.

You Try: Decrypt the message that has a shift of 8.

UG NIDWZQBM VCUJMZ QA BPZMM

A: My favorite number is three.


Breaking the Caesar Cipher

 

Breaking the Caesar Cipher is easy. It may seem like a mess at first, but with a little data analysis we can easily crack it.

Cipher text: TLLA TL PU AOL OHSS HMALY SBUJO

The Caesar Cipher is a symmetric cipher which means that any given letter is always mapped to the same letter. When we see repetitions in the cipher text, those are also repetitions in the plain text.

We can use a frequency analysis  of the English Language to see how often certain letters, words, and letter combinations occur. (see below)

From the frequency charts, I look for the most frequently occurring letter. In plain text the more frequent letter is “e”. In our cipher text the most frequent letter is “L”. The location of “L” in the 3 letter word “AOL” corresponds to where the letter “e” is in “the”.

The shift from “e” to “L” is 7, which also corresponds for the entire word “AOL” to be “the”. Using a shift of 7 on the rest of the sentence will obtain,

“MEET ME IN THE HALL AFTER LUNCH”

My new decryption wheel is as follows

shift8

 

Don’t get fooled into thinking that you only need to use find “the” in any given sentence (this sentence only has 1 instance of that word occurring, and that’s because I’m referring directly to it). Sometimes there is trial and error involved. Regardless, if you stick to your analysis it should be pretty easy.


 

You Try: Break the code by using frequency analysis. What is the shift number?

OMWZOM IVL Q EMVB BW BPM XIZS

A: George and I went to the park. Shift=8.

 


 

Letter & Word Frequency

 

These numbers are obtained by dividing  \frac{\text{\# of letter}}{\text{Total \# of letters}}

letterfreq

Most common strings of 3 letters

the, and, tha, ent, ing, ion, tio, for, nde, has, nce, edt, tis, oft, sth, men

 

 

 

 

 

 

 

 

One thought on “Shift Ciphers

  1. The Caesar cipher is named after Julius Caesar , who, according to Suetonius , used it with a shift of three to protect messages of military significance. While Caesar’s was the first recorded use of this scheme, other substitution ciphers are known to have been used earlier.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.