Message143127
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. |
|
Date |
User |
Action |
Args |
2011-08-28 23:26:13 | dbagnall | set | recipients:
+ dbagnall, rhettinger, vstinner, sturlamolden |
2011-08-28 23:26:13 | dbagnall | set | messageid: <1314573973.14.0.907780455447.issue12754@psf.upfronthosting.co.za> |
2011-08-28 23:26:12 | dbagnall | link | issue12754 messages |
2011-08-28 23:26:11 | dbagnall | create | |
|