X
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time.
This article has been viewed 17,518 times.
Learn more...
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
Method 1 of 3:Preparation
Method 1
-
1Write 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. -
2Give one copy to your agent. Keep the other.Advertisement
Method 2
Method 2 of 3:Encrypting a message
Method 2
-
1Write the message at the top of a piece of paper. Our message is
hello. -
2Convert it into number.
Hellobecomes8 5 12 12 15. -
3Write 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. -
4Convert the key into numbers. The key is now
1 2 7 19 4. -
5Add 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 3119. -
6For every number over (not equal to) 26, subtract 26. Our codetext becomes
9 7 19 5 19. -
7Convert back into letters. Our codetext message is
IGSES. -
8Destroy 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. -
9Send the message.Advertisement
Method 3
Method 3 of 3:Decrypting a message
Method 3
-
1Your agent sends you a message back. You need to decrypt it. Say the message is
WTNGPFM. -
2Write 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. -
3Write the necessary letters from the one-time pad underneath. This is the key. Our key is
peycngh. -
4Convert the key into numbers. Our key becomes
16 5 25 3 14 7 8. -
5Subtract 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. -
6For any negative number, or zero, add
26. The message is now7 15 15 4 2 25 5. -
7Convert into letters. The message is
goodbye. -
8Destroy the part of the one-time pad that was used. Our one-time pad is now f.Advertisement
Community Q&A
-
QuestionHow many letters do I need for the code? Which ones?
Community AnswerYou only need the amount of random letters you require for the coded message. -
QuestionHow do I choose one time pad?
Community AnswerRandomly -- start rolling dice. Methods like taking every 10th letter from the King James Bible or using a computer's pseudorandom number generator are vulnerable to cryptanalysis. Only a truly random pad is theoretically unbreakable.
References
- Cracking Codes (The Knowledge) by Diana Kimpton ISBN: 9780439981842
About This Article
Advertisement
























































