Bugtraq mailing list archives

Re: Generating a true random number?


From: mouse () Collatz McRCIM McGill EDU (der Mouse)
Date: Mon, 6 Jun 1994 02:19:42 -0400


I need to generate an 8 byte random DES key, so of course, I need a
way of generating 8 random bytes.  Any ideas?

Assuing you don't need to do it very often, my preferred method is
rolling dice.  (When I want to generate "hard" passwords, for example,
I roll dice to generate seven-bit characters, and then throw out the
control characters.  I have a program that lets me type digits 1-8 at
it and it does the rest.)

You probably want dice whose number-of-sides figures are powers of two.
I usually use the d8s from the dice I collected back when I was playing
D&D (such dice are available at any hobby shop around here; presumably
they are also common elsewhere).  You can substitute regular six-sided
dice and throw out rolls that turn up 5 or 6, or perhaps do something
more sophisticated with base-6 numbers.

If you need strong random numbers, you're usually best off using a
strong process (ie, a nondeterministic one) to generate them.
(Depending on which model turns out to accurately describe physics,
rolling dice may or may not be truly nondeterministic.  If the dice are
even approximately fair, it's plenty close enough for any application
DES is good enough for - assuming the person rolling the dice isn't
trying to cheat, which can be assumed here.)

                                        der Mouse

                            mouse () collatz mcrcim mcgill edu



Current thread: