Add FAQ about source of randomness (/dev/urandom versus /dev/random).

This commit is contained in:
Steven D'Aprano 2015-10-16 21:43:39 +11:00
parent 758b704c4a
commit 918bac0fbc
1 changed files with 12 additions and 0 deletions

View File

@ -338,6 +338,15 @@ Frequently Asked Questions
module, instead it will be given in the documentation as a recipe (à la
the recipes in the ``itertools`` module) [30]_.
* Q: Will ``secrets`` use /dev/random (which blocks) or /dev/urandom (which
doesn't block) on Linux? What about other platforms?
A: ``secrets`` will be based on ``os.urandom`` and ``random.SystemRandom``,
which are interfaces to your operating system's best source of
cryptographic randomness. On Linux, that may be ``/dev/urandom`` [31]_,
on Windows it may be ``CryptGenRandom()``, but see the documentation
and/or source code for the detailed implementation details.
References
==========
@ -412,6 +421,9 @@ References
.. [30] https://mail.python.org/pipermail/python-ideas/2015-September/036488.html
.. [31] http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
http://www.2uo.de/myths-about-urandom/
Copyright
=========