DICE is a DOS program I wrote to generate fair dice rolls that can be used to play games by mail (PBM) or by electronic mail (PBEM). The rolls generated are unpredictable to either player, yet after the game each player can each check that the other used only rolls generated by the program.
You are welcome to download this program; it is freely distributed. There are two versions, the dice.exe program itself, or a smaller zipped file of it (which of course you have to unzip to decompress).
I wouldn't mind, if you find it useful or interesting, if you dropped me a line at lotsie@aol.com and told me so. (Complaints can go to bitbucket@nowhere.com.)
One caveat. The security (unpredictability) of DICE rests on the inability of either side to solve the so-called "discrete log problem". A lot of modern cryptography is based on the intractibility of that problem. However, to keep the program fast I did not use a very large modulus, so brute force methods could probably be used to "crack" it. The bottom line is I would only recommend using the program for fun, not for any game in which money or value could change hands.
DICE is self-documenting when you type "dice ?". Here is that help screen:
Format: dice password [ delta ] [ /sides=n ] [ /rows=n ] @filename DICE is a utility for playing board games by electronic mail. This is version 2 of the program. It can be used as a fair source of random numbers for die rolls, as well as a way to register secret information with your opponent without revealing the information. GENERATING DIE ROLLS WHEN THERE IS A SOURCE OF "RANDOMIZING" FILES This feature was also available in DICE version 1. In many situations the exact contents of a file are known to both players after the move is sent but cannot be predicted ahead of time. For example, the time stamps and forwarding information added by the system to your move message might be adequately unpredictable. Or, you can use an upcoming event as the randomizing file, for example, "the lead news story tomorrow". Any data that can be put in a file can be used as the randomizing element for DICE, as follows: dice @filename > rolls where "filename" is the name of the randomizing file. This will fill the file named "rolls" with thousands of random die rolls. (You can pick any name for this file.) The random die rolls depend only on the contents of the randomizing file; if a single character changes in that file, entirely different die rolls will be generated. Both sides can run DICE on the file and check each other. The file "rolls" will also have a "hash number" in it. You should ignore this number; it is not important when using DICE in this way. Dies of any number of sides may be specified with the optional '/sides' switch--for example, '/sides=10'. Without '/sides' you always get a six-sided die. GENERATING DIE ROLLS WHEN THERE IS NO RANDOMIZING SOURCE This is a new feature of DICE Version 2. At the beginning of the game, both players pick their own secret passwords and run: dice password /rows=0 You send the hash number that DICE prints out to your opponent, and your opponent does likewise for you. After the hash numbers are exchanged, you each pick your own "delta" number which can be any number that appeals to you. The purpose of this number is to provide an additional source of randomness to prevent your opponent from having picking a password that generated favorable die rolls for him. You also send the delta numbers to your opponent, and he sends his to you. Then you run: dice password delta > rolls where 'password' is your password and 'delta' is your OPPONENT'S delta number. He is doing the same thing on his machine. The rolls file you create will have tens of thousands of random die rolls that you will use to resolve your opponent's moves throughout the game. Likewise, he will have a different file on his machine to resolve your moves. Without knowing each other's passwords, it is mathematically intractable for you to calculate future die rolls from the die rolls that are revealed to you. On the other hand, after the game is over, you both can reveal your passwords and you both can check that the hash and the die rolls were correct. It is a good idea, when sending your moves during the game, to request rolls in a way that is unpredictable to your opponent. For example, you might say "start taking rolls from row 107 for this move" or "skip five rows". That way your opponent cannot modify his strategy knowing your upcoming rolls. Your password can be any length, but cannot have blanks in it unless you put it in a file. In that case, type: dice @pwfile delta > rolls The '@' tells DICE that what follows is not the password but a name of a file to read for the password. If you do not need as many rows of rolls as DICE creates for you, you can use the option "/rows=nnn" on the command line. REGISTERING SECRET INFORMATION This is a new feature of DICE version 2. Suppose you are playing a game that allows secret placement or movement. You write your secret placement or move in a file, and run: dice @myfile /rows=0 where "myfile" is the name you have chosen for the file. DICE will respond with the message "File 'myfile' hashes to=nnnnnnnn". You send the number "nnnnnnnn" to your opponent. During the course of the game, when the secret is finally revealed, you can send the file to your opponent. He can run DICE on the file and verify that the hash number is the same as the one you told him earlier. The chance that two files will have the same hash number is less than one in a billion, so he can be confident that you have not modified the file after you sent him the hash number. Note: Your opponent can always make up test files and run DICE to see if they hash to the same number that you sent him, so very short files that could be easily guessed should be avoided. You can always pad the actual game information with other irrelevant data (like an amusing message to your opponent, perhaps?). Copyright 1994 by Jeffrey Lotspiech. All rights reserved. Copies may be made and distributed for private non-commercial use. Send comments to Lotsie@aol.com (America Online). (Type "dice ? | more" to prevent this help from scrolling too fast, or "dice ? > lpt1" to print.)
Changes last made on January 19, 1997.
This page has been visited
times since January 19, 1997.
Return to Jeff Lotspiech's AOL
home page.