A ‘pad’ or list of random numbers between 1 and 36. There are instructions for making your own pad at the end of the activity. You can download one here:

A one time pad is a code. It consists of two parts – a coded message, and a set of random numbers, called a ‘pad’. You need both of these to decode the message. You can make the ‘pad’ in advance and give it to your target months or even years before you encode your message.

To make a coded message:

Grab your encoding sheet

Write your message in the row marked ‘Uncoded message’ with one letter per box.
In the row marked ‘Uncoded number’, write down the number for each letter with A=1, B=2, C=3 etc. The numbers are written on the side of your sheet to make it faster.
In the third row, labelled ‘One-time pad’, write down the numbers in your pad, with one number per box

Now, add each ‘Uncoded number’ to the ‘One-time pad’ number below it. Write these numbers in the ‘Number + pad’ row.

Finally, if you have any numbers that are larger than 36, subtract 36 and write it in the ‘Coded message’ row. Otherwise, just write the ‘Number + pad’ number in the box.

Now write the numbers in the ‘Coded message’ row, and the numbers in the ‘One-time pad’ row on two separate pieces of paper. Make sure you label them, or you might decode them backwards.

To decode a message:

Get a copy of the decoding sheet.

Copy the numbers of the message into the row marked ‘Coded message’ and the numbers of the pad into the row marked ‘One-time pad’

If the pad number is bigger than the message number, then add 36 to the message number, and write this in the ‘Plus 36’ row

Subtract the number in ‘One-time pad’ from the number in ‘Plus 36’. If there is no number in ‘Plus 36’, then subtract from ‘Coded message’ instead. Write your answer in the ‘Decoded number’ box

For each number in ‘Decoded number’, turn it into a letter, using A=1, B=2, C=3 etc. There is a list of the letters and their numbers on your sheet to make it faster. Write these letters in the row marked ‘Decoded message’

You should now have a decoded message!

To make new one time pads

Get two dice, one red, and one any other colour except red.

Roll the two dice

Subtract 1 from the red die, and then multiply it by 6. Then add the other die to this number. To make it a bit quicker to calculate, use the following table:

Repeat this until you have enough numbers for your code. Remember, you need one pad number for every letter in your message!

What’s happening:

The one time pad is the most secure code in the world. This code is regularly used by spies and governments around the world. For example, the US President has a special phone to the Russian President, so they can prevent wars. This phone is protected by a one-time pad system, so no-one else can tell what they are talking about.

If a spy gets a copy of your encoded message, then it doesn’t help them at all. There are too many possible messages it could have been before you encoded it. For instance, the coded message

13 7 29 2 33 29

When decoded with the pad 12 23 9 1 30 18 gives ATTACK

But when decoded with 6 28 21 23 20 24 gives GOHOME

In fact, there is a pad that that will decode this message into any text you want. And as long as you’ve kept your pad secret, there’s no clue as to which one is the right one.

If you only have a copy of the encoded message, you can’t work out anything about the message that was sent. You can’t even work out one letter! In order to get any information about the message being sent, you need to get both the coded message, and the pad.

Applications:

The one-time pad works by adding randomness to your message. It adds so much randomness that your message also becomes random. This is very secure, but only if you are very careful with it. If your random numbers aren’t actually random, then other people might spot the pattern in your pad. Once they can guess your pad, they can break your code.

You also can’t re-use the same pad. A message is encoded by adding a different number to each letter in your message. If you encode two messages with the same pad, a spy can subtract the two numbers from each other. This removes the random number, and you end up with one letter, minus the other letter. This might seem secure, but it is actually quite easy to break. In the 1940s, the Russian spy agency NKVD re-used several of their one-time pads. British and US spies managed to use this to decode thousands of secret messages in an operation known as VENONA.