[issue12754] Add alternative random number generators

2016-09-06 Thread STINNER Victor
STINNER Victor added the comment: I agree with what Nick wrote. It became easy to install a third-party module, and we made progress on APIs to get random bytes from the system. I'm not convinced neither that Mersenne Twister limitations are important enough to replace it. If you want to see

[issue12754] Add alternative random number generators

2016-09-06 Thread Nick Coghlan
Nick Coghlan added the comment: Since this issue was opened, a few relevant changes have been made: * firstly the random.SystemRandom API and subsequently the "secrets" module were added to provide ready access to the operating system's cryptographically secure PRNG. This addresses the "At lea

[issue12754] Add alternative random number generators

2011-08-30 Thread STINNER Victor
STINNER Victor added the comment: Before trying to find the best (CS)PRNG, can't we start with ssl.RAND_bytes() and ssl.RAND_pseudo_bytes()? I would be nice to use ssl.RAND_pseudo_bytes() to generate crypt.mksalt(): see issue #12858 -- ___ Python t

[issue12754] Add alternative random number generators

2011-08-29 Thread douglas bagnall
douglas bagnall added the comment: I am no kind of crypto expert, but from what I read, there are no known attacks on chacha8 or salsa20/12 better than brute-forcing the key, and distinguishing the stream from random or deducing state would be considered an attack. There's a summary of the E

[issue12754] Add alternative random number generators

2011-08-28 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue12754] Add alternative random number generators

2011-08-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks Douglas. Can you say what the cryptographic guarantees are for Chacha and Salsa (seeing a stream of randoms doesn't allow you to do deduce internal state, previous randoms, or future randoms)? Is it suitably strong for gaming (dealing poker hands

[issue12754] Add alternative random number generators

2011-08-28 Thread douglas bagnall
douglas bagnall 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

[issue12754] Add alternative random number generators

2011-08-28 Thread douglas bagnall
douglas bagnall added the comment: Earlier this year I wrote Python wrappers for a number of generators: https://github.com/douglasbagnall/riffle They are mostly cryptographic stream ciphers from the ESTREAM[1] project, but I was also interested in dSFMT[2], which is a SIMD optimised descenda

[issue12754] Add alternative random number generators

2011-08-17 Thread Sturla Molden
Sturla Molden added the comment: "The problem is that the Python API can only produce one number per call and a function call in Python is really slow (it creates a Python frame). If you want to speed it Python, it would be better to add methods to generate arrays to limit the overhead of Pyt

[issue12754] Add alternative random number generators

2011-08-16 Thread STINNER Victor
STINNER Victor added the comment: "On my laptop, KISS4691 could produce about 110 million random numbers per second (148 millon if inlined), whereas MT19937 produced 118 million random numbers per second." The problem is that the Python API can only produce one number per call and a function

[issue12754] Add alternative random number generators

2011-08-16 Thread STINNER Victor
STINNER Victor added the comment: I don't know if it would help you, but I wrote a C library offering a simple API and supporting various RNG (cryptographic, hardware, pseudo, ...). It reuses existing libraries like GSL, OpenSSL, glib, gcrypt, etc. It supports UNIX/BSD /dev/*random devices an

[issue12754] Add alternative random number generators

2011-08-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please focus your thoughts. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Sturla Molden added the comment: Further suggestions to improve the random module: ** Object-oriented PRNG: Let it be an object which stores the random state internally, so we can create independent PRNG objects. I.e. not just one global generator. ** Generator for quasi-random Sobol sequenc

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Changes by Sturla Molden : Added file: http://bugs.python.org/file22906/prngtest.zip ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Changes by Sturla Molden : Removed file: http://bugs.python.org/file22905/prngtest.zip ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Sturla Molden added the comment: Another (bug fix) post by Marsaglia on KISS4691: http://www.phwinfo.com/forum/comp-lang-c/460292-ensuring-long-period-kiss4691-rng.html -- ___ Python tracker _

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Sturla Molden added the comment: I'm posting the code for comparison of KISS4691 and MT19937. I do realize KISS4691 might not be sufficiently different from MT19937 in characteristics for Raymond Hettinger to consider it. But at least here it is for reference should it be of value. -

[issue12754] Add alternative random number generators

2011-08-15 Thread Sturla Molden
Sturla Molden added the comment: George Marsaglia's latest random number generator KISS4691 is worth considering, though I am not sure the performance is that different from MT19937. Here is a link to Marsaglia's post on comp.lang.c. Marasglia passed away shortly after (Feb. 2011), and to m

[issue12754] Add alternative random number generators

2011-08-15 Thread Raymond Hettinger
New submission from Raymond Hettinger : While keeping the MT generator as the default, add new alternative random number generators as drop-in replacements. Since MT was first introduced, PRNG technology has continued to advance. I'm opening this feature request to be a centralized place to d