[issue12754] Add alternative random number generators

douglas bagnall report at bugs.python.org
Mon Aug 29 02:03:12 CEST 2011


douglas bagnall <douglas at paradise.net.nz> added the comment:

A bit more on the state size and period of the stream ciphers.

Chacha and Salsa use 64 bytes (512 bits) of state (vs ~2.5kB for MT19937).

Its counter is 64 bits, and its seed can be 320 bits (in cipher-speak, the seed is split between a 256 bit key and a 64 bit IV).

Each counter iteration produces 64 random bytes, or 8 doubles, so for any seed, you get a cycle of 2 ** 67, which would last in the order of 100 thousand years on current PCs.

Some of the other ciphers I looked at have smaller seeds and states, and some produce fewer bytes per iteration, but I don't think any of them will result in a cycle of smaller than 2 ** 64.

PS: Regarding the discussion of something like Random.getrandbytes(n): +1

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12754>
_______________________________________


More information about the Python-bugs-list mailing list