Codes and ciphers

Codes and ciphers

Many would consider that “code” and “cipher/cypher”  mean the same. The Oxford English Dictionary describes them as:

code (noun): “a system of words, letters, figures or symbols used to represent others, especially for the purposes of secrecy”.

cipher (variant cypher) (noun): “a secret or disguised way of writing: a code; … something written in code; …a key to a code”.

The distinction

Contrary to what the layperson perceives, a code is where each word in a message is replaced with a code word or symbol, whereas in a cipher each letter is replaced with a cipher letter or symbol. When most people say “code” they are actually referring to ciphers.
Codes work at the level of meaning, that is, words or phrases are converted into something else, which generally shortens the message.

Historical usage

Historically, pen and paper ciphers used in the past and popularized by fiction and movies are sometimes known as classical ciphers. They include simple substitution ciphers, where individual letters or groups of letters are replaced by other letters throughout a communication. A well-known example of a substitution cipher is the Caesar cipher. This works by each letter of message being replaced by the letter three positions later in the alphabet. Hence, A is replaced by D, B by E, etc. Finally, Y and Z are respectively replaced by B and C. But it need not necessarily be three letters as any number would work.

A simple and easy to solve encryption would be to write every word backwards. For example, “Hello my name is David”, would become “olleH ym eman si divaD”. If capital letters were reduced to lower case ones it might not be so obvious, but even so it is not much of a challenge.

In transposition ciphers the letters themselves are unchanged, but their order within the message is scrambled according to some well-defined scheme. Many transposition ciphers are done according to a geometric design such as a rectangular or square grid.

The previous examples were both examples of monoalphabetic substitution ciphers, where just one cipher alphabet is used. It is also possible to have a polyalphabetic substitution cipher, where multiple cipher alphabets are used. This makes the message much harder to decode because the codebreaker would have to figure out which cipher alphabet has been used to encrypt the message. Simple ciphers were replaced by polyalphabetic substitution ciphers (such as the Vigenère), which changed the substitution alphabet for every letter.

Modern usage

Electromechanical machines were invented during the early twentieth century, whereby encryption and decryption using transposition, polyalphabetic substitution, and a kind of “additive” substitution. Rotor machines used several rotor disks to provide polyalphabetic substitution, while plug boards provided another substitution. Keys were easily changed by changing the rotor disks and the plugboard wires. These encryption methods were more complex than previous ones and required electromechanical machines to encrypt and decrypt, such as the British Bombe, which was invented to crack messages produced by the German Enigma machines during World War II.

However, codes have a variety of drawbacks, including susceptibility to cryptanalysis and the difficulty of managing a cumbersome codebook. Because of this, codes have fallen into disuse in modern cryptography, and ciphers are the dominant technique.