# How to Write an Unbreakable Code

Three Methods:PreparationEncrypting a messageDecrypting a message

Codes have been around since the dawn of mankind. Now, especially with the introduction of computers, codes are becoming easier and easier to crack. However, there is one code that is impossible to crack - a one-time pad code.

## Steps

### Method 1 Preparation

- 1
**Write a one-time pad.**You will need this to encrypt your messages. A one-time pad is a pad of paper with a random sequence of letters written on it. You will need two exact copies - one for yourself, one for your agent (the person receiving the message). Lets' say our one-time pad is abgsdpeycnghf. - 2
**Give one copy to your agent, and keep the other.**

### Method 2 Encrypting a message

- 1
**Write the message at the top of a piece of paper.**Our message is hello. - 2
**Convert it into numbers.**Hello becomes 8 5 12 12 15. - 3
**Write down the letters of the one-time pad underneath.**You only need as many letters as there are in the message. Using our one-time pad, these are abgsd. This is the key. - 4
**Convert the key into numbers.**The key is now 1 2 7 19 4. - 5
**Add together the corresponding numbers to get the codetext.**Add the first letter of the message to the first letter of the key, second to second, etc. Our codetext is 9 7 19 31 19. - 6
**For every number over (not equal to) 26, subtract 26.**Our codetext becomes 9 7 19 5 19. - 7
**Convert back into letters.**Our codetext message is IGSES. - 8
**Destroy the part of the one-time pad that you used.**This is why it is a one-time pad: each part is used once. If it's written on paper, tear it off and burn it. Our one-time pad is now peycnghf. - 9
**Send the message.**

### Method 3 Decrypting a message

- 1
**Your agent sends you a message back.**You need to decrypt it. Say the message is WTNGPFM. - 2
**Write the message at the top of a piece of paper.**Convert it into numbers and write these underneath. The codetext is now 23 20 14 7 16 6 13. - 3
**Write the necessary letters from the one-time pad underneath.**This is the key. Our key is peycngh. - 4
**Convert the key into numbers.**Our key becomes 16 5 25 3 14 7 8. - 5
**Subtract the corresponding numbers of the key from the message.**23-16 = 7, 20-5 = 15, 14-25 = -11, etc. Our message becomes 7 15 -11 4 2 -1 5. - 6
**For any negative number, or zero, add 26.**The message is now 7 15 15 4 2 25 5. - 7
**Convert into letters.**The message is goodbye. - 8
**Destroy the part of the one-time pad that was used.**Our one-time pad is now f.

## Tips

- So long as you destroy each part of the one-time pad after you use it, and nobody gets hold of a copy of the one-time pad, this code is unbreakable. Take the first message, IGSES. It means hello. However, without the correct one-time pad, it could be deciphered to mean alice or laser or death. In fact, it could be deciphered to mean any five-letter word. Without the one-time pad, you don't know which word, so the message is secure.

## Sources and Citations

- Cracking Codes (The Knowledge) by Diana Kimpton ISBN: 9780439981842

## Article Info

Categories: Codes and Hidden Messaging