On 04/17/2015 12:41 PM, Reco wrote:
And 'shred' uses /dev/urandom in turn: $ strace -e trace=file shred -s 100M - > /dev/null … open("/usr/lib/locale/locale-archive", O_RDONLY) = 3 open("/dev/urandom", O_RDONLY) = 3 Although, according to strace, 'shred' cheats and only reads 2k bytes from /dev/urandom, and not 100m as 'dd' does.
'shred' probably uses /dev/urandom to seed and periodically re-seed an internal PRNG.
[Perl's Math::Random::ISAAC::XS] doesn't seem to use kernel-based entropy at all. Thank you for pointing me out at it, now I know it so I avoid it.
ISAAC is very useful when I want a repeatable stream of random numbers, such as for testing.
ISAAC can generate cryptographically secure random number streams by feeding it a "good" random seed:
2015-04-17 14:22:23 dpchrist@t2250 ~$ time dd if=/dev/random bs=16 count=1 2>/dev/null | perl -MMath::Random::ISAAC::XS -e '$r=Math::Random::ISAAC::XS->new(@ARGV);while(print $r->irand){}' | dd iflag=fullblock of=/dev/null bs=1M count=100 2>/dev/null
real 0m18.350s user 0m18.305s sys 0m0.256s David