Glossary

Select one of the keywords on the left…

Codes and CiphersIntroduction

Reading time: ~30 min

In the early 2000s, the Colombian government was fighting a civil war against groups of insurgents, who were hiding in camps in the South American rainforest. Occasionally, soldiers were captured by these rebels, and then had to spend months or even years in captivity.

It is easy to lose hope when you’ve been chained up in a hostage camp for such a long time, unable to see your family, and guarded by armed guerilla forces. However, in 2010, there was reason to be hopeful: the army was approaching, and planning to rescue them shortly.

Unfortunately, it seemed impossible to tell the prisoners that help was coming, without also alerting their capturers – that is, until Colonel Jose Espejo came up with an ingenious idea. With his team, he wrote a new pop song, embedded a secret message in the chorus, and then played it thousands of times over the radio.

To the rebels, it sounded just like meaningless music, but to the prisoners listening in, it was a message of hope. See if you can spot the message – it starts around 1:30.

There are many other examples in our world, where we want to communicate with others, but we can’t use our voices or text. Maybe your friend lives across the street from you. At night, you secretly talk to each other using flashlights – without waking up your family by shouting.

For example, one short flash might mean “hello” or “yes”. One long flash might mean “how are you?”, and two short flashes might mean “good night”. Can you come up with any other signals you might need?

However, even if you agree many different signals for different words or questions, it will be difficult to have more complex conversations, or to talk about new topics…

Morse Code

In the early 19th century, the only way to transmit messages across long distances was my mail or by messenger. Companies like the “Pony Express” ran delivery routes with couriers riding on horses, but it could still take days or even weeks to send a message between distant cities.

This all changed in 1837, with the invention of the telegraph. Using electric cables spanned across the country, it was possible to send messages almost instantly.

The pony express next to a telegraph line under construction – a painting by George Ottinger

The first commercial telegraph was developed by William Forthergill Cooke and Charles Wheatstone, and used compass needles to point at different letters on a display.

One year later, the inventor Samuel Morse, together with his assistant Alfred Vail, developed an even better version of the telegraph.

Pressing a button at one end of the telegraph line closes an electronic circuit. This means that current is flowing, which triggers a buzzing sound at the other end of the telegraph line.

To send more complex messages, Morse represented every letter in the alphabet using a unique sequence of short beeps (called dits or dots) and long beeps (called dahs or dashes):

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z

For example, to transmit the letter E, we just have to send one . To send the letter U, we have to send . Morse had invented a new “language”, which we now call the Morse code.

This telegraph machine also records messages on a long strip of paper.

Now we can send any message by first converting its letters into Morse code, and then tapping out the corresponding dots and dashes on the telegraph.

One of Morse’s goals was to keep the messages as short as possible. This is why common letters like E and T have a very short code, while uncommon letters like J or Q have much longer codes.

Morse code quickly became popular all around the world. Trained operators can send around 25 words per minute, which corresponds to six dots or dashes every second!

The most famous Morse code signal is “SOS”, which indicates that you have an emergency and need help. It consists of three dots, followed by three dashes, followed by three more dots. Try writing other words or sentences in this box, and watch how they are encoded as Morse code:

SOS

Morse code was also what the Colombian army used to send a message to the hostages. Translated from Spanish, the message was 19 PEOPLE RESCUED. YOU’RE NEXT. DON’T GIVE UP. Listen to the song once more, and see if you can hear the dots and dashes in the background:

If you don’t know Morse code, this may just sound like part of the music – but the hostages were soldiers who had been trained in Morse code, and recognized it in the song when they heard it on the radio. A few days later, they were rescued and safely returned home.

It turns out that there were many other examples throughout history, where Morse code has been used to communicate secret (or not so secret) messages:

The red warning light at the top of the Capitol Records building in Los Angeles blinks out the word HOLLYWOOD in Morse code.

When captured during the Vietnam war, Navy pilot Jeremiah Denton blinks the word TORTURE in Morse, while being forced to record a propaganda video.

During World War II, a British prisoner was forced to create decorative stitchings like this one. Can you find (and decipher) the hidden Morse code messages?

Codes and Information

Wherever we look, we are surrounded by information, like books and newspapers, numbers and charts, photos, images, music, or movie clips.

A code is a rule or algorithm that can be used to express information in a certain format. One example is our alphabet, which can be used to express language as a series of written symbols (called letters). Another example we saw before is the Morse code, which expresses words as sequences of .

But this is only the beginning, and there is a huge variety of codes that can be used for different purposes, or to encode different kinds of information. In this course, we will explore some of the most important and most interesting ones.

Codes are not a recent invention – they were used by ancient cultures, many thousands of years ago.

For example, guards along the Great Wall of China used smoke to warn each other about potential attacks. Different tribes of indigenous peoples in North American each had their own signalling systems: they created columns of smoke by burning damp grass, which allowed them to communicate over long distances.

Smoke signals are even used today, for example as a distress signal at sea. And when a new Pope is elected by the College of Cardinals, the outcome of each vote is indicated by black or white smoke.

Native American Smoke Signals – a painting by John Mix Stanley

There are many other examples where words or letters are not the best way to express information. Here are some other codes you might have heard of:

Phonetic Alphabet

Many letters sound very similar – especially when spoken over the phone or radio, with loud background noise. That’s why the military, police, pilots, and many others use the NATO Phonetic Alphabet when they have to spell names. Here, every individual letter is replaced with a unique word:

AAlpha
BBravo
CCharlie
DDelta
EEcho
FFoxtrot
GGolf
HHotel
IIndia
JJuliet
KKilo
LLima
MMike
NNovember
OOscar
PPapa
QQuebec
RRomeo
SSierra
TTango
UUniform
VVictor
WWhiskey
XX-ray
YYankee
ZZulu

For example, saying “Mike–Alpha–Tango–Hotel–Sierra” would spell the word .

Maritime Flags

Ships can use Maritime Signal Flags, which are hung from their masts, to communicate with other ships within sight range.

Storage for signal flags onboard a US Navy ship

Decorative flags on a sailing boat

All flags have different colours or patterns, and represent a different letter:

AA
BB
CC
DD
EE
FF
GG
HH
II
JJ
KK
LL
MM
NN
OO
PP
QQ
RR
SS
TT
UU
VV
WW
XX
YY
ZZ

For example, if you see the flags on a passing ship, you should .

Flag Semaphore

Flag Semaphore is another way to communicate using flags, which was used long before the invention of the telegraph. In this case, all flags are the same, but holding them in different positions indicates different letters:

AA
BB
CC
DD
EE
FF
GG
HH
II
JJ
KK
LL
MM
NN
OO
PP
QQ
RR
SS
TT
UU
VV
WW
XX
YY
ZZ

The Beatles wanted to use Semaphore to spell the word “HELP” on the cover of their album with the same name.

However, they didn’t like the way these specific letters looked – so they just chose four random letters instead! As you can see, they ended up spelling the word !

The Genetic Code

Codes even appear inside our own body! The DNA is a long molecule that appears in every cell of your body, and contains the genetic instructions for how all living organisms work. It consists of four different components, called nucleotides:

Adenine

Thymine

Cytosine

Guanine

A strand of DNA consists of billions of these nucleotides, which contain the instructions for the development and functioning of our body. We can represent them using sequences of the letters A, T, C and G.

Similar to Morse code, every three consecutive nucleotides correspond to a specific amino acid, a small component used by the cells in our body. For example, AAG represents Lysine, an amino acid we consume by eating food like eggs, meat or soybeans.

The genetic code has space for 43=64 amino acids (four options for each of the three nucleotides in a triple), but only 20 are actually needed in our body.

Finally, remember that the same symbol can mean completely different things within different codes. For example, the letter C can be represented by “Charlie” in the NATO Phonetic Alphabet, it could be the maritime flag , or it can represent Cytosine if placed within a strand of DNA letters.