cvs commit: src/sys/libkern arc4random.c

David Schultz das at FreeBSD.ORG
Sat Aug 23 02:19:18 PDT 2003


On Fri, Aug 15, 2003, Poul-Henning Kamp wrote:
> In message <200308151911.h7FJBkOI003844 at grimreaper.grondar.org>, Mark Murray wr
> ites:
> 
> >For the paranoids, this is cheap (almost free), and is solid from a
> >arcfour-neurotic perspective.
> 
> We should actually have a script in src/tools/regression which ran
> some or all of the stuff from http://csrc.nist.gov/rng/ on our
> various random sources...

Another test suite, which seems to be highly regarded, is
Marsaglia's DIEHARD package.  The sources themselves are probably
on the web somewhere, and there's some sample output from the last
time the subject of randomness came up on the lists at
http://www.csua.berkeley.edu/~das/marsaglia/ .
I can run it again if there's interest.

Note that it requires a little bit more effort to test for the
kind of problem Mike was trying to solve by throwing out the first
few numbers after reseeding.  The issue there is that while some
RNGs produce good results when you seed them once and call them
repeatedly, they may not appear so random with respect to the
intial seed.  That is, if you keep reseeding with successive
numbers in a predictable pattern, the initial sequences you get
out of the generator may not look so random when you string them
all together.

I'm not a cryptographer, but FWIW, I'm told that there are
statistical tests that can differentiate an ARC4 sequence from a
truly random sequence.  However, it takes something like 2^31 bits
of data to detect the statistical bias.


More information about the cvs-src mailing list