Commit Graph

8 Commits

Author SHA1 Message Date
NewUserHa 55c96e8053
gh-99305: Speed up secrets.token_hex() ~2x (#99306)
simple code modernization.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2022-11-11 14:45:24 -08:00
Hugo van Kemenade 6881ea936e
bpo-47126: Update to canonical PEP URLs specified by PEP 676 (GH-32124) 2022-03-30 12:00:27 +01:00
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