I looked into these, and they seem to work rather well. I considered adding them to this module, but there were a few things that made me decide, ulimately, not to:
- RtlGenRandom is available only in W2K and WinXP; and there are rumours that it will not be available in the next generation(s) of Windows. There are still a great many Win98 installations out there.
- If I use /dev/random for UNIX and RtlGenRandom on Windows, I've solved two OS issues. That's great for my current project, but the personal goal I had when developing this module is to be general-purpose and platform-independant. I wish to avoid special cases when possible.
- I see this module as an alternative to OS-based PRNG's. If someone is developing a tool that requires a good PRNG, I would expect them to use the best PRNG for the job. In other words, I want to leave it to the end developer to, say, prefer /dev/random first, RtlGenRandom, then this module if neither of the former are available.
- The seed doesn't need to be very random, just hard to guess or duplicate based on general information about the system (the pid and/or the current time are bad, since loggers can guess this information closely enough to significantly narrow a brute-force search). The seeder I have now is so-so in this regard: it should stop anyone who doesn't have root-access to the machine from guessing the seed.
- If you already have a good PRNG, you don't need this module anyway. ;-)
In short, I envision the use of this module like:
my $prng;
if ( -f '/dev/random' ) {
$prng = sub { get_rand_from_file('/dev/random', shift) };
}
elsif ( ## Find out if RtlGenRandom works ## ) {
$prng = \&rtlGenRandom_rand;
}
else {
require Crypt::Random::ISAAC;
$prng = \&Crypt::Random::ISAAC::rand;
}
I do appreciate your pointing me to those references, though, as they will help with performance on a project that is Win2k-only.
<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
The Code that can be seen is not the true Code
| [reply] [d/l] |