douglas bagnall <doug...@paradise.net.nz> 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 descendant of MT19937 which runs several times faster and directly produces doubles using cunning bit tricks. [1]http://www.ecrypt.eu.org/stream/ [2]http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/#dSFMT Wrapped in Python, the stream ciphers ran about as fast as MT19937 on my laptop, while dSFMT took about two thirds the time to run a "random();random();random();..." test. For a slightly more realistic test ("sum(random() for x in range(N))"), the performance levelled right off. As expected. The stream cipher generators have some good properties. They generally generate random bytes using something analogous to hash('%s%s' % seed, counter), which means different seeds produce well separated streams, and to skip forward or back in the stream, you just adjust the counter. This would allow the reinstatement of Random()'s stream-skipping function, which some people (e.g. L'Ecuyer) think is important. (incidentally, the MT people have come up with a jump-ahead algorithm for MT http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/JUMP/index.html). Of the ciphers I tried, the chacha/salsa family and sosemanuk had the best combination of good testing and portable, reasonably fast, openly licensed C implementations. HC128 and snow2 also perform well. The chacha code is shorter than sosemanuk, so I would choose that. It is used as a primitive in the BLAKE SHA3 candidate, which is a vote of confidence and an attractor of testing for the algorithm. ---------- nosy: +dbagnall _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12754> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com