You are currently browsing the tag archive for the ‘one time pad’ tag.

Screen Shot 2015-06-22 at 2.04.35 PM

The one time pad is a very secure way of encoding messages – so secure in fact that it is unbreakable as long as the agents using it don’t make any mistakes. It was a very popular method of sending coded messages during the Second World War – and persisted well into the Cold War, when secret agents on the ground in a foreign country could encode their reports without fear that they would be broken by the enemy.

The picture above is from a one time pad code sheet which was used in the Second World War. What would happen is that the secret agent would be issued with a code book with lots of pages such as the page shown above. The person who was to receive the coded message would have an identical copy of this book kept securely in the home country. Now, the secret agent would infiltrate a foreign country and start to gather data. To encode it he would choose a page from the codebook, encode his message using the method will look at in a minute, and then the receiver would once he knew which page of the codebook had been used, would be able to decipher very quickly.

The one time pad is uncrackable as long as the codebook uses truly randomly generated numbers (not easy!) and as long as each page from the codebook is only used once – and is never discovered by the enemy. Sometimes this code was cracked because agents became lazy and reused the same pages, other times because the agent was captured and their codebook discovered. Nevertheless, in the age before digital communications it was a very secure method of encoding data.

How does the one time pad work?

It’s all based on Modulo arithmetic (mod 26). This sounds complicated, but basically we just work out the remainder when we divide by 26. For example 4 is still 4 mod 26, because 4 divided by 26 is 0 remainder 4. 30 is also 4 mod 26 because 30 divided by 26 is 1 remainder 4. For negatives we just keep adding 26 until we get a positive number. eg. -10 = 16 mod 26.

Now, say I want to encode the message ” Attack”. I assign each letter in the alphabet a value between 0 and 25 (A = 0, B = 1 etc).

Screen Shot 2015-06-22 at 2.25.45 PM

So Attack = 0 19 0 2 10

Next I use my one time pad. Let’s use the one pictured at the top of the page. The first 5 random numbers are 54048, so I add these in turn working in mod 26 if required.

0 + 5 = 5

19 + 4 = 23

0 + 0 = 0

2 + 4 = 6

10 + 8 = 18

Now I convert these new number back into the alphabet using A = 0, B = 1 etc as before. This gives my code word as:

FXAGS

I can then send this back home using my chosen method (e.g. in a letter perhaps hidden as the first word of every sentence etc). The person receiving the code simply has to work in reverse using the same code pad. He converts FXAGS to numbers:

5 23 0 6 18

and he notes the numbers in his code pad are 54048 so he takes away to reveal the message:

5 – 5 = 0

23 – 4 = 19

0 – 0 = 0

6 – 4 = 2

18 – 8 = 10

Screen Shot 2015-06-22 at 2.25.45 PM

This reveals the hidden message, Attack!

Screen Shot 2015-06-22 at 3.58.28 PM

The beauty of this code is that it can even be done without a code pad – indeed deep cover secret agents were often too scared of being caught with a code book that they used ordinary books. This works in the same way, as long as both parties have agreed in advance on what copy book to use. Say I choose to use John Le Carre’s spy classic The Honourable Schoolboy, page 1 paragraph 1. This can sit innocuously on my bookshelf and yet I can create an equivalent to a code pad by taking each word in turn to make a number. In this case the first word is Afterwards – which would give me the code pad numbers 0 5 19 4 17 22 0 17 3 18. I could then use this to encode in the same manner as above.

Website Stats

  • 7,560,105 views

IB Maths Exploration Guide

IB Maths Exploration Guide

A comprehensive 63 page pdf guide to help you get excellent marks on your maths investigation. Includes:

  1. Investigation essentials,
  2. Marking criteria guidance,
  3. 70 hand picked interesting topics
  4. Useful websites for use in the exploration,
  5. A student checklist for top marks
  6. Avoiding common student mistakes
  7. A selection of detailed exploration ideas
  8. Advice on using Geogebra, Desmos and Tracker.

Available to download here.

IB HL Paper 3 Practice Questions (120 page pdf)

IB HL Paper 3 Practice Questions 

Seventeen full investigation questions – each one designed to last around 1 hour, and totaling around 40 pages and 600 marks worth of content.  There is also a fully typed up mark scheme.  Together this is around 120 pages of content.

Available to download here.

IB Exploration Modelling and Statistics Guide


IB Exploration Modelling and Statistics Guide

A 60 page pdf guide full of advice to help with modelling and statistics explorations – focusing in on non-calculator methods in order to show good understanding. Includes:

  1. Pearson’s Product: Height and arm span
  2. How to calculate standard deviation by hand
  3. Binomial investigation: ESP powers
  4. Paired t tests and 2 sample t tests: Reaction times
  5. Chi Squared: Efficiency of vaccines
  6. Spearman’s rank: Taste preference of cola
  7. Linear regression and log linearization.
  8. Quadratic regression and cubic regression.
  9. Exponential and trigonometric regression.

Available to download here.

Recent Posts

Follow IB Maths Resources from British International School Phuket on WordPress.com