Brian (et al),

Here's what I'm doing.  I'm using the RTL's random number generator in this
thing, but what I'm counting on more than the randomization of the Sleep
times is the fact that Windows takes a different amount of time to complete
each system call, code segment, etc. (and hence each Sleep) due to time
slicing, interrupt handling, or whatever else causes such discrepancies.
I've run many batches of 100 of these seed algorithms and collected and
compared the results and they produced a pretty reasonable distribution of
apparently random data.  

Because of the uncertainty about the amount of time it takes a given set of
instructions to complete, I think it would be very difficult for someone to
reproduce the results, even if they knew this algorithm, the RTL randomizer
algorithm, and even the RTL randomizer seed (thus reproducing the exact same
"random" sequence of Sleep times that I did when I generated the seed data).


In fact, to test this theory, I changed all of these to  just "Sleep(1)" (no
random sleep time) to remove the RTL randomizer from the equation
altogether, and the results from consecutive trials are very different and
appear just as random and unpredictable.

As far as the Performance Timer itself goes, it's standard - you have it.

If anybody sees any fundamental flaw in this, I would appreciate another
heads up to alert me to the folly of my ways.  I like it because it runs in
just a few seconds on a 500MHz PIII with NT4 and I can make it part of my
startup code so that it's different every time without taking forever to
start up.  Does this work, or am I in the weeds again?  (Snake-Oil the
Sequel?)  

Thanks!

                unsigned char seed[64];
                randomize ();

                for (int ii = 0; ii < 64; ii++)
                {
                        LARGE_INTEGER val;

                        // use only the low bit 8 times over instead of
using all 8 at once
                        QueryPerformanceCounter (&val);
                        seed[c][ii] = (unsigned )(val.LowPart & 0x01) << 7;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 6;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 5;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 4;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 3;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 2;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01) << 1;
                        Sleep(random(2));

                        QueryPerformanceCounter (&val);
                        seed[c][ii] |= (unsigned )(val.LowPart & 0x01);
                        Sleep(random(2));
                }

                RAND_seed (seed, sizeof (seed));


-----Original Message-----
From:   Brian Hatch [mailto:[EMAIL PROTECTED]]
Sent:   Thursday, June 22, 2000 10:01 AM
To:     Bill Rebey
Subject:        Re: Cipher question...



> I've changed my original snake-oil RNG seed generator to use the results
of
> the Window Performance Counter (a very high resolution clock).  The trials
> that I've run and compared side by side appear to generate a pretty good
> mess of data that doesn't appear to offer up any sort of patterns or
> consistency.

Don't suppose you'd like to let the rest of us in on what
you're using now, eh?  Is 'windows performance counter'
something extra, or does it come with all versions of windows?



--
Brian Hatch                Email returned
   Systems and              to sender --
   Security Engineer        insufficient
http://www.ifokr.org/bri/   voltage.

Every message PGP signed
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to