[Python-Dev] BDFL ruling request: should we block forever waiting for high-quality random bits?
mertz at gnosis.cx
Fri Jun 10 16:01:12 EDT 2016
On Fri, Jun 10, 2016 at 12:55 PM, Larry Hastings <larry at hastings.org> wrote:
> On 06/10/2016 12:29 PM, David Mertz wrote:
> I believe that secrets.token_bytes() and secrets.SystemRandom() should be
> changed even for 3.5.1 to use getrandom() on Linux.
> Surely you meant 3.5.2? 3.5.1 shipped last December.
Yeah, that combines a couple thinkos even. I had intended to write "for
3.5.2" ... but that is also an error, since the secrets module doesn't
exist until 3.6. So yes, I think 3.5.2 should restore the 2.6-3.4 behavior
of os.urandom(), and the NEW APIs in secrets should use the "best available
randomness (even if it blocks)"
Donald is correct that we have the spelling secrets.token_bytes() available
in 3.6a1, so the spellings secrets.getrandom() or secrets.randbytes() are
not needed. However, Sebastian's (adapted) suggestion to allow
*, nonblock=False) as the signature makes sense to me (i.e. it's a choice
of "block or raise exception", not an option to get non-crypto bytes).
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev