dark mode light mode Search Menu
Search

Unbreakable Random Codes

Richard Patterson on Flickr

Codes are great fun and are a technology that has been used to pass secret information throughout history. These days the principles of codes and ciphers are used in computing to encrypt data and to keep our information safe. Great amounts of work is undertaken by cryptologists to test the effectiveness of and create new code systems.

We are going to look at one of the oldest approaches to creating coded messages, an approach that uses a “one time pad”. This approach might be old, but if done correctly is actually impossible to break! Many coded messages rely on replacing letters with something else that represents them and simple codes can be made where an individual letter is always replaced with the same “coded” letter or number or symbol. For example “ROT13” is a type of code that does this. ROT13 takes the 26 letters of the English language alphabet and places half the letters in two opposing rows, the letters are then swapped between the rows to encode them. So for example the word BEANZ becomes the word ORNAM. However, systems like ROT13 are vulnerable. If you have a paragraph of ROT13 encoded text, even without knowing how ROT13 works, you can begin to work out what the letters might represent. Looking for the most commonly reoccurring letters in the text we could guess that these might be the more common vowel letters, A,E,I,O,U. Then you might be able to spot some of the smaller 2 or 3 letter words like “an, on, it, the” etc. Through a process of trial and error and guesswork you could definitely crack the code!

One time pads differ in that they create a system where each letter is encoded and turned into a number and this number is very unlikely to repeat for the same letter. This leads to a very secure code! One time pads are made and they are a type of pre shared key, both the message sender and the recipient have the same one time pad and use this to encode and decode a message. As the ore shared one time pad contains the information needed to decode the message, as the name suggests, it should only ever be used once. This is because if you used the same pad to encode and decode multiple messages they could be cracked using comparison methods across the messages. There are different ways to generate and use one time pad but for ours we are going to begin by creating a list of randomly generated numbers between 1 and 100.

To do this we used two 10 sided dice. We decided that the green dice would represent the units of ten and the red dice the single units, so rolling a 3 on green and a 4 on red gives the number 34. We decided that if we ever rolled 0 and 0 we would count this as 100. We rolled the dice lots of times and created a list, actually we wrote each value into two lists so we had a pad for the message encoder and a pad for the recipient. You need to have enough random numbers for the amount of letters in the message you want to encode. When we wrote down our numbers we tended to group them in groups of 5 numbers as this makes it a bit easier to keep track of.

To encode a message with a one time pad you first assign a number to each letter of the alphabet, so A =1, B=2, C=3, etc. To practice, write out your plain text message you want to encode. For example we used “Hey Beanz”. Take the numeric value for each letter and in turn add that value to the next value in the one time pad list. So for example, the first letter of our plain text is H, this is 8 in the alphabet and we add this number to the first value on the pad, 84, which gives 92. We then repeat this for the next letter, E which is 5 in the alphabet and we add the next value in the pad, 60, giving 65 and so on.

Continue through the message until you have completed it. You now have your plaintext encoded, this encoded message is sometimes referred to as your ciphertext. The ciphertext for “Hey Beanz” can be seen in the green oblong as reading 92, 65, 98, 33, 10, 65, 43, 25. Note that within even this short message we have some good examples of why this type of code is hard to crack. The letter E appears twice in the plaintext but in the ciphertext it ends up with totally different values. Similarly we also have the number 65 repeating in the ciphertext but when decoded it represents a totally different letter.

Once the message has been passed to the recipient they carefully works through the process in reverse, taking each number in turn and subtracting the corresponding number on the one time pad. If the one time pads have been kept totally secret and aren’t reused then this is a very secure method, even if the cipher text is seen by others or read out loud the plain text message is still protected!

Learn More

One time pad

https://en.wikipedia.org/wiki/One-time_pad

One time pad overview

https://www.educba.com/one-time-pad/

the unbreakable code

https://www.cryptomuseum.com/crypto/otp/index.htm

About the One Time pad

https://academickids.com/encyclopedia/index.php/One-time_pad

What is a one time pad

https://wiki.kidzsearch.com/wiki/One-time_pad

What is ROT13

https://en.wikipedia.org/wiki/ROT13

ROT13 coder and decoder

https://rotencoder.com/

ROT13 facts

https://wiki.kidzsearch.com/wiki/ROT13

Secret codes for kids

https://www.giftofcuriosity.com/secret-codes-for-kids/

Random numbers

http://www.randomnumbers.info/content/Random.htm

Cryptology for kids

https://www.cerias.purdue.edu/education/k12/teaching_resources/lessons_presentations/cryptology.html

How random number generation works

https://www.commonlounge.com/discussion/481152258acb4003a5903d2fc1bc425f