Commit graph

6 commits

Author SHA1 Message Date
Victor Stinner 9f5fe7910f
bpo-40286: Add randbytes() method to random.Random (GH-19527)
Add random.randbytes() function and random.Random.randbytes()
method to generate random bytes.

Modify secrets.token_bytes() to use SystemRandom.randbytes()
rather than calling directly os.urandom().

Rename also genrand_int32() to genrand_uint32(), since it returns an
unsigned 32-bit integer, not a signed integer.

The _random module is now built with Py_BUILD_CORE_MODULE defined.
2020-04-17 19:05:35 +02:00
Raymond Hettinger e9ee207622 Issue #29061: secrets.randbelow() would hang with a negative input 2016-12-29 22:54:25 -07:00
Steven D'Aprano 4ad465424a Shorten secrets module docstring, add function docstrings. 2016-04-17 13:13:36 +10:00
Steven D'Aprano 6dda1b14af Remove python fallback for compare_digest.
See https://mail.python.org/pipermail/python-dev/2016-April/144198.html
https://mail.python.org/pipermail/python-dev/2016-April/144203.html
2016-04-16 04:33:55 +10:00
Steven D'Aprano a873f68248 run Tools/reindent.py on secrets.py to satisfy the checkwhitespace hook 2016-04-15 01:55:14 +10:00
Steven D'Aprano 95702725ff Add secrets module and tests. 2016-04-15 01:51:31 +10:00