CIPHER VS. CODES
To begin, let’s make sure we understand the difference between a cipher and a code. Actually, I dare you to get up and go ask someone the same question right now. While you do that I’ll wait here and admire this Lorenz cipher machine...
Did they stumble around for an answer? For most people, it’s as if you asked them what the difference was between mix and blend. Tough question...Luckily, you’ve already watched the video on Morse Code, so you are comfortable with the idea of a codebook. In that video we saw how telegraph operators could save time by mapping entire sentences to shorter words.
Here, the word Accountant is code for: Come at once. Do not delay. A code is a mapping from some meaningful unit (word, sentence, phrase) into something else (usually a shorter group of symbols). For example we could make up a code where the word Apple is written as 67. Generally codes are ways of saving time, and when sending messages around the world, time is money.
A codebook is simply a list of these mappings, and these have been around ever since we began writing. Just remember, a code requires a codebook.
Okay, so what about ciphers?
Most importantly, ciphers do not involve meaning. Instead they are mechanical operations (known as algorithms) which are performed on the individual or small chunks of letters. For example, in the Caesar Cipher we saw how each letter in the alphabet (A,B,C...) was mapped to a different letter (A=D, B=E,C=F...) according to a specific shift (3). Known as a shift cipher.
In this case we don’t need a codebook, instead we follow a series of instructions (“shift each letter by __”) also known as an algorithm. The algorithm requires one piece of shared information known as a key (in the above example the key is 3). This shared key is required for two parties to encrypt (HELLO = KHOOR) & decrypt (KHOOR=HELLO) messages.
So back to our question. What is the difference between codes and ciphers? Codes generally operate on semantics (meaning) while ciphers operate on syntax (symbols). A code is stored as a mapping in a codebook, while ciphers transform individual symbols according to an algorithm.
Next let’s review the mechanics involved in the Caesar cipher and earn some exercise points while working towards our Cryptography badge!