Re: [Python-Dev] writing to /dev/*random [was: BDFL ruling request: should we block ...]

2016-06-12 Thread Donald Stufft

> On Jun 11, 2016, at 8:16 PM, Stephen J. Turnbull  wrote:
> 
> This fails for unprivileged users on Mac.  I'm not sure what happens
> on Linux; it appears to succeed, but the result wasn't what I
> expected.


I think that on Linux it will mix in whatever you write into the entropy, but 
it won’t increase the entropy counter for it.

—
Donald Stufft



___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] writing to /dev/*random [was: BDFL ruling request: should we block ...]

2016-06-11 Thread Larry Hastings

On 06/11/2016 05:16 PM, Stephen J. Turnbull wrote:

Use a Raspberry-Pi, or other advanced expensive hardware.
There's no real excuse for not having a hardware generator if the Pi
has one!


Intel CPUs added the RDRAND instruction as of Ivy Bridge, although 
there's an ongoing debate as to whether or not it's a suitable source of 
entropy to use for seeding urandom.


   https://en.wikipedia.org/wiki/RdRand#Reception

Wikipedia goes on to describe the very-new RDSEED instruction which 
might be more suitable.



//arry/
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] writing to /dev/*random [was: BDFL ruling request: should we block ...]

2016-06-11 Thread Stephen J. Turnbull
This is related to David Mertz's request for backward compatible
initialization, not to the bdfl decision.

Steven D'Aprano writes:

 > I don't think that's something which the Python interpreter ought to do 
 > for you, but you can write to /dev/urandom or /dev/random (both keep 
 > their own, separate, entropy pools):
 > 
 > open("/dev/urandom", "w").write("hello world")

This fails for unprivileged users on Mac.  I'm not sure what happens
on Linux; it appears to succeed, but the result wasn't what I
expected.

Also, when entropy gets low, it's not clear how additional entropy is
allocated between the /dev/random and /dev/urandom pools.

 > But of course there's the question of where you're going to get a
 > source of noise to write to the file. While it's (probably?) 
 > harmless to write a hard-coded string to it, I don't think its
 > going to give you much entropy.

Use a Raspberry-Pi, or other advanced expensive hardware.
There's no real excuse for not having a hardware generator if the Pi
has one!  I would guess you can probably get something with a USB
interface for $20 or so.
http://scruss.com/blog/2013/06/07/well-that-was-unexpected-the-raspberry-pis-hardware-random-number-generator/
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com