One-Time Pad (OTP) Generation and Use

Sparks 31

To properly generate a One-Time Pad (OTP), you need a source of random numbers. There are electronic random number generators, but the cheapest way to generate randomness is to “roll the bones” as Geddy Lee and Neal Peart would say.

For our purposes, the easiest way to do this is by using 10-sided dice. They are also known as “D10” dice. Those of you who used to play Dungeons and Dragons, or some other role-playing game, or board-type wargame in the 1980s know what I’m talking about (and still probably have a bag of assorted dice packed away somewhere). For the rest of you, a 10-sided die looks like this:  

10-sided dice

Buy at least five of them. Make sure all your friends have some too. An Internet search of “10-sided dice” or “D10 dice” will find all sorts of sellers. There is one seller on Ebay that has a package of 100 for $15+shipping. If you find a hobby shop that caters to gamers, D10 dice will cost you about a buck each in small quantities.

For our purposes, the best way is to buy a set of new casino dice (6-sided or “D6”). They start at $10 for a set of five. They are precision made to a tolerance of 0.0006 inches, are serialized, and come sealed in a foil package. Do not buy retired or “canceled” dice. Casinos will often retire a set of dice by drilling a hole in the die that can affect the randomness. Casino dice will be more random than D10 gamer dice. Whether the added cost for the extra randomness is worth it is up to you.

If you are using D10 dice, you can roll them five at a time to get a five-digit random number. A single page in a OTP is typically 50 groups of five digits. To make it easier on yourself you can use five different die colors, or just take the results from left-to-right, front-to-back, or whatever. If you are using D6 dice, roll them in multiples of 2, treat any result of 6 as 0, and add the results of two dice together to get an end result of 0-9. Place the dice into a plastic cup, give them your best James Bond casino shake, and roll them out onto a padded surface that has some “bounce” to it. Keep doing this until you have generated enough random numbers for your OTP needs.

As dice are used, they will begin to wear and become less random. Casinos typically use a set of dice for an 8 hour shift and then retire them. After a set of dice you are using has 8 hours of wear on them, retire them from operational use, and use them for deceptive communications.

Do not record your random numbers on a computer. By doing so, you will make your OTP vulnerable to compromise. OK, I might transcribe them on to an ancient 8-bit Atari 800 for printing on a 9-pin dot matrix printer of similar vintage, provided I bought both items at an out of state flea market with cash ten years ago and have not let them leave my sight since then. Anything newer runs a good risk of compromise. Instead, do what the Hipsters and Germans are doing. Find yourself an old typewriter and purchase a package of carbon paper. Do not use a word processor or anything else that has a CPU in it!!! Those of you who like a nostalgic touch can find an old Clark Nova. More realistically you will probably find a more recent vintage electric typewriter such as an IBM Selectric with a small pitch font. When you are done recording your numbers, take the ribbon and carbon paper you used and put a blowtorch to them until they are either ash or a melted unrecognizable blob. Ideally, you will only use this typewriter for making OTPs, as individual typewriters can be traced via forensics. I will refer readers to ASTM Standard E2494-08 for more information. Perhaps, after you are done generating OTPs for a while, you can donate the typewriter to Goodwill or sell it at a distant flea market to some Hipster who voted for Obama.

So now you will have OTP sheets that look something like this:

98634 78493 09873 20563 24384
48243 18343 02539 12043 10345
10509 06782 12345 10367 10235
10324 03867 73825 46813 97616
54321 93265 12309 73654 73544

You will have two copies of a OTP. One for the sender and one for the receiver. To use a OTP, you first have to convert your plaintext to a simple numeric code such as this:

A=11 B=12 C=13 D=14 E=15 F=16
G=27 H=28 I=29 J=30 K=31 L=32
M=43 N=44 O=45 P=46 Q=47 R=48
S=59 T=60 U=61 V=62 W=63 X=64
Y=75 Z=76 0=77 1=78 2=79 3=80
4=91 5=92 6=93 7=94 8=95 9=96

Let’s now take the message “USE PLAN ALPHA7” and encode it.

  1. USE PLAN ALPHA7
  2. 61-59-15-46-32-11-44-11-32-46-28-11-94
  3. Now take the numbers from your OTP
  4. 98-63-47-84-93-09-87-32-05-63-24-38-44
  5. And add the two. If the answer is greater than 100, then subtract 100.
  6.    61-59-15-46-32-11-44-11-32-46-28-11-94
    +98-63-47-84-93-09-87-32-05-63-24-38-44
    =59-22-62-30-25-20-31-43-37-09-52-49-38 → This is your ciphertext.
  7. To decode, take your ciphertext and subtract the numbers from your OTP to get the numeric code. If the answer is a negative number, add 100.
  8.    59-22-62-30-25-20-31-43-37-09-52-49-38
    – 98-63-47-84-93-09-87-32-05-63-24-38-44
    = 61-59-15-46-32-11-44-11-32-46-28-11-94
  9. Finally, convert the numeric code to plaintext.
  10. 61-59-15-46-32-11-44-11-32-46-28-11-94
    U-S-E-P-L-A-N-A-L-P-H-A-7

Remember to remove and destroy the sheet off the OTP after you use it. Reuse of OTPs will compromise the message.

http://sparks31.wordpress.com/2014/12/31/happy-new-year-reader-request-one-time-pad-otp-generation-and-use/

2 thoughts on “One-Time Pad (OTP) Generation and Use

  1. Why are we here? Because we’re here! Roll the Bones! I think I will start out the day with some Rush at 97 DB! Thank’s Paraclete:)

  2. This is absurd. The author puts you through a lot of trouble to generate random numbers and a lot of arithmetic and there are much easier ways to send coded messages.

    Instead of the sender and receiver producing copies of this book of random numbers, they can use two copies of any book in existence, and each word of their message would be represented by a page number, and a sequential number for each word on that page.

    For example: two people have a copy of “A Christmas Carol” along with a hundred other books in a book case, but only the sender and receiver know which book they’re using.

    “Marley was dead, dead as a doornail.”
    1-3 (page one, third word) is “dead” and there’s no way to decipher that without knowing what book they’re using. To encode names you’ll have a prearranged word to substitute for each name needed, and there probably won’t be too many of them. Even if the list of names is found, it’s worthless without knowing what book the code uses.

Join the Conversation

Your email address will not be published. Required fields are marked *


*