Codes and Ciphers

From SCOUTS South Africa Wiki
Jump to navigation Jump to search

Codes have been around for many years and been used by many different sort of people. They were used by ancient Egyptians, Greeks, people in war, and people in distress (Morse Code). There are hundreds of different types of codes, and only a few of those feature in the scout book. Here is an introduction to coding and some more interesting codes.

What is a code

A code is the general term for any system for changing a message. A code is just a different way of saying something, to make it harder or easier to understand.

A bilateral code contains just two different letters, numbers or symbols. Morse code is such an example (dots and dashes). This code makes it easier to send messages longer distance using only flashes of light or beeps.

A cipher is a code in which each letter or number is represented by another letter or number. This is the one that many cubs and scouts are familiar with.

Encryption just means the act of concealing information by turning it into code.

Hieroglyphics is coded picture writing. Each letter or word is represented by a picture or symbol. The scouts are also used to a type of this code.


The history of codes

The oldest code that we know about appeared in Egypt, four thousand years ago. In the town of Menet Khufu, on the edge of the Nile, a craftsman was telling the story of his lord's life by carving special symbols into the rock wall of his tomb. Mostly he used hieroglyphic symbols that were well known at the time, but occasionally he carved new ones. Anyone reading these new hieroglyphics would have to study them for a while and figure out how they worked before being able to read the inscription.

The idea started to catch on. Tomb inscriptions became more and more complicated, with several different 'codes' being used. Sometimes a completely new symbol would be created. The writer might pick a hieroglyphic with a similar shape to the one normally used, and a third technique involved spelling out words with the first letters of the symbols carved. The reader would have to work out what each hieroglyphic was supposed to represent, then write down all the initial letters to spell out a message.


So if the reader came across tomb carvings of

  • something shining in the sky
  • a tropical bird
  • what you would wear on your hand
  • frozen water
  • what you smell with
  • a percussion instrument with wooden or metal bars

he would write down the letters S(un) P(arrot) H(at) I(ce) N(ose) X(ylophone) and come up with the word SPHINX.


Try your own
What about if the pictures he found were as follows:

  • something to write with, filled with ink
  • the yellow part of an egg
  • water from the sky
  • the seed of an oak tree
  • the largest thing shining in the night sky
  • an Eskimo's house
  • what you open to enter a room

What word do these hieroglyphics spell out?

For a while, the ancient Egyptians believed that codes like these increased the magical power of burial inscriptions. They thought it was important to make people study your gravestone for as long as possible, keeping your memory alive.


Types of code

Polybius codes

Polybius was a Greek writer who loved to invent secret codes. He drew up a grid, put letters into the squares, then numbered every row and column. That way, any letter could be identified by a two-digit number: the first digit indicating the row and the second telling you the column. The grid has 25 squares which fit all letters of the alphabet from left to right, but I and J share a square. This will not cause confusion as its easy to guess which letter is correct.

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

So for example:

A is 11
B is 12
M is 32
Y is 54


Try solve this code: 44 23 15 / 22 34 31 14 / 24 43 / 24 33 / 43 11 21 15 / 14 15 35 34 43 24 44 / 12 34 53 / 33 45 32 12 15 42 / 43 15 51 15 33 44 15 15 33


Pigpen cipher

Pigpen cipher key
Pigpen cipher key

This type of code is one of the more popular cub and scout codes. It is made up of two tic-tac-toe style grids and two 'x' grids, one set with dots and one without. The code is made up of sections of the pigpen grid, with or without dots, for example: A-pigpen-message


Numbers Stand for Letters

This is a very easy code to solve! Each number stands for a letter.

1 stands for A
2 stands for B
3 stands for C
etc.


To solve this code, you should write out the whole alphabet, and then write out the numbers from 1 to 26 below each letter.

Plain text: 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
Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Example:

SCOUT = 19 3 15 21 20


Reverse the Alphabet

This code is similar to Numbers Stand for Letters but instead of using numbers, you are using the alphabet backwards. It helps to write the plain text letters in CAPITAL and the code in lower case (or visa versa) to avoid getting confused.

Plain text: 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
Code: z y x w v u t s r q p o n m l k j i h g f e d c b a

Example:

SCOUT = hxlfg


Sliding Scale, Cryptograph, or Code Wheel

You can 'slide' the code alphabet along by any number of letters. For example, the below slides by 2 letters. A Cipher Wheel can be helpful for cubs and scouts to create and solve these codes.


Plain text: 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
Code: c d e f g h i j k l m n o p q r s t u v w x y z a b

Example:

SCOUT = ueqwv

Musical Code

The musical code is a way to send a message (or write down information like a password) using what looks like a bit of sheet music, this is much less commonly used than pigpen or substitution codes (A=1, B=2). For this reason, it is a good code to know.

Musical code

Code word in alphabet

You can make a code based on a special code word which only you know about. For example, if you use the word "SCOUT", you first write down the normal alphabet (called the Plain Text alphabet), and below it we write the Code alphabet, starting with the codeword, and following the codeword with the rest of the alphabet. Remember that you don't want repeated letters! When you get to the normal alphabet you leaving out the letters already in your code.

Plain text: 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
Code: s c o u t a b d e f g h i j k l m n p q r v w x y z

Example:

SCOUT = poklq
HELLO = dthhk


Cryptarithm

A cryptarithm is a game where letters have been substituted for numbers. You have to work out which letters relate to which numbers so that the addition works correctly. Rules: Each letter represents only one number, and each number is only one letter. Example:

Question: I + BB = ILL Answer: 1 + 99 = 100 In this example, I is always 1, B is always 9 and L is always 0. You must give the numbers for the full sum, e.g. 1 + 99 = 100

Try these:

OOOH + FOOD = FIGHT
HAPPY + HAPPY + HAPPY + DAYS = AHEAD
SEND + MORE = MONEY


Communication and signalling methods

Morse Code

Morse Code is a substitution code where each letter is replaced by a sequence of dots and dashes (on paper), short and long beeps (audibly), or short and long light flashes (visually).


Semaphore

Semaphore is a system of signalling using flags. It can be used to signal between ships and also across open land.


Phonetic alphabet

The Phonetic alphabet is a way of representing a letter with an entire word. This is used often when communicating letters can be ambiguous, e.g. reading the serial number of your new cellphone to an insurance company over a bad phone line. You will know some words already, such as Alpha, Bravo, Charlie.


Cracking codes

Its one thing to encode and decode a message with a known code, but how would you decipher a coded message if you didn't know the code?

What sort of code it is?

Does it contain numbers? If the numbers were all between 1 and 26, it is likely each number represents a letter of the alphabet. Are the numbers perhaps directing you to pages, lines and words in a particular book, newspaper or magazine? For example 120.12.3 could be the third word in line 12 of page 120.

Does it contain symbols or shapes? These could represent letters, words, or even phrases.

Frequency Tables

In all languages, some letters appear more frequently than others. In English, the letter used most often is E, followed by T, A and O. The frequency order in English is: E T A O N R I S H D L G C M U F Y P W B V K X J Q Z So if you have a coded message, its very likely that the letter, number or symbol that appears the most times is being used to represent E, T, A or O.

If you have a code that is made up of symbols, letters or numbers that you suspect represent individual letters, then create a frequency table. Write each symbol once and count how many occurrences you find in the code. Then use the above frequency order (E T A O N…) to guess which symbols mean which letters.

Deduction

A lot of deducing needs to be done to crack a code. Common sense helps. For example, single letters are almost always I or A. Double letters: In English most double letters (like seed and boot) in a word are B, D, E, F, G, L, M, N, O, P, R, S, or T.

Patience is one of the codebreaker's most important qualities. One Arab cryptologist deciphered a secret message intended for the Sultan of Morocco – but only after studying it for fifteen years!

Summery to cracking unknown codes:

  1. Compile a frequency table
  2. Look for words with only one letter
  3. Spot any double letters
  4. Compare words with similar letters
  5. Make sensible guesses: e.g. the most common letter is probably E, and the word THE is likely to appear at least once
  6. When you know a few of the letters in a word, go through all the possible words in your mind
  7. Look for unusual combinations of letters


See also

Cub Secret Codes Badge

Resources