This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients alex, neologix, pitrou, rhettinger, tim.peters
Date 2014-05-11.01:49:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399772963.48.0.55861943277.issue21470@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not sure it is good practice to read that many bytes from /dev/urandom. Quoting the Linux man page for /dev/urandom:

       The  kernel random-number generator is designed to produce a small amount of
       high-quality seed material to seed a cryptographic pseudo-random number gen‐
       erator  (CPRNG).   It  is  designed  for  security, not speed, and is poorly
       suited to generating large amounts of random data.   Users  should  be  very
       economical  in  the amount of seed material that they read from /dev/urandom
       (and /dev/random); unnecessarily reading large quantities of data from  this
       device will have a negative impact on other users of the device.

The (default?) entropy pool size under Linux is 4096 bytes, so reading 2500 bytes will deplete more than half of it, IIUC. Example:

$ cat /proc/sys/kernel/random/poolsize 
4096
$ cat /proc/sys/kernel/random/entropy_avail 
516
$ python -c "import os; os.urandom(300)"
$ cat /proc/sys/kernel/random/entropy_avail 
160
History
Date User Action Args
2014-05-11 01:49:23pitrousetrecipients: + pitrou, tim.peters, rhettinger, alex, neologix
2014-05-11 01:49:23pitrousetmessageid: <1399772963.48.0.55861943277.issue21470@psf.upfronthosting.co.za>
2014-05-11 01:49:23pitroulinkissue21470 messages
2014-05-11 01:49:22pitroucreate