[issue21470] Better seeding for the random module

Marc-Andre Lemburg report at bugs.python.org
Tue May 13 11:04:13 CEST 2014


Marc-Andre Lemburg added the comment:

neologix:

According to man rand(3ssl), OpenSSL uses an internal state of 1023 bytes for the RNG.

You only see it reading 32 bytes from /dev/urandom in the strace because it has already loaded 1024 bytes from the RNG state file ~/.rng before adding another 32 bytes:

open("/home/lemburg/.rnd", O_RDONLY)    = 3
read(3, "..."..., 4096) = 1024
read(3, "", 4096)                       = 0
Generating RSA private key, 512 bit long modulus
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 3
read(3, "...", 32) = 32

FWIW: I'm with Raymond and Tim on this one. I prefer to have a good seed in an RNG per default, simply because most application don't bother to reseed RNGs every now and then, so having a good start into the day is important :-)

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21470>
_______________________________________


More information about the Python-bugs-list mailing list