Simple Cyphers

Making and Breaking

Here's the problem: We have a message we want to send, and we want only certain people to be able to read it. Sometimes we cannot guarantee that only the people we want will be the ones to see the message. Encryption is the act of changing a message so that people cannot read it unless they know how to decrpyt the message back again.

Encryption is usually spoken about in two parts: There's the cypher, which is the general method that you will use to encrypt and decrypt your message. There's also the key, which is usually a small but crucial piece of information, without which your opponents will struggle to decrypt your message. Think of it as a locked door: Everyone knows roughly how locks work (and you should assume everyone knows how your cypher works,) but people with the key find it far easier to get through the door.

Note that your opponents will find it hard, not impossible, to decrypt messages. They can keep on guessing which key will work until they eventually find the right one. Finding the key is known as breaking the encryption. Realistically one usually speaks of how long it will take someone to read your messages. If it takes someone over a hundred years to read your messages to your bank, then it's pretty likely you will have already closed that account by then and so those messages are considered "safe enough."

Letters and numbers

The roman alphabet comes in a specific order (A then B then C, etc.) so we can refer to letters either directly A, B, C ... or by their position in the list A = 1, B = 2, C = 3, ...

Here's a table of the letters and their associated number, so you don't have to work it out every time.

The Caesar Cypher

Supposedly this cypher was used by Julius Caeser to send orders to generals without spies reading them. It works by taking each letter in turn and shifting it a certain number of places through the alphabet. So if we wanted to shift the letter "B" by 5, we

This is exactly the same as just counting five letters along from B. What do you think should happen if your number goes higher than 26?

Try it here: I take the letter , I shift it by places to the right and get the answer .

We want to send a message privately. For example, here's a message:

We want to shift each letter places to the right. This gives us:

Caesar's general has just received the message

So what are they to do with it? Caesar, being organised, told the generals before leaving Rome that each letter was going to be shifted by , (this part is the key) so all the generals need to do is shift each letter back again.

We want to shift each letter places to the left. This gives us:

Here are some things to think about:

The Vigenère Cypher

The Caesar cypher can be broken in just twenty-six guesses, so if your opponent knows what sort of encryption you are using (you should always assume they do know this) then they can break it pretty quickly. There's a way of combining multiple Caesar cyphers, attributed to Blaise de Vigenère in the sixteenth century, that makes use of multiple Caesar cyphers in succession.

The Caesar Cypher shifted every single letter by the same number of places. What if we shifted the first letter by, say, 2, then the second by 5, then the next by 2, then 5, then 2, and so on? Instead of having to guess 1 thing from 26 options, your opponents now have to guess 1 thing from 26 x 26 options! Your allies, too, need to know both "2" and "5" (in that order) as the key. But wait! We can convert numbers to letters, and then it makes sense to put them next to each other in order. "2" then "5" is "B" then "E" as letters, so we could just tell our allies the word "BE".

The Vigenère Cypher works by taking a word, like " ", and using those letters over and over again as though they were keys for Caesar Cyphers.

So in each column we have: The letter we want to encrypt, the letter we treat as the key for a Caesar Cypher, and then the encrypted letter. Notice that changing one letter in the key affects only some of the encrypted text, but changing the length of the key changes the whole text (apart from the initial few letters.) We decode again using the same key, but doing the Caesar Cyphers backwards. Try putting in different keys here:

More questions: