SHA-based subclass for random module

Paul Rubin http
Thu Mar 18 01:17:12 EST 2004


python at rcn.com (Raymond Hettinger) writes:
> Because SHA-1 is a digest function, additional input can be tacked on
> without impacting invertibility.  That gives you an opportunity to
> incorporate the Mersenne Twister to take advantage of its provably
> long period.

I don't see any point to including Mersenne Twister output in the SHA
update.  If you want to make sure of a long period, it's easier to
just mix in a simple counter.  Note that the generator I posted should
have period about 2**160 since in order to repeat, two different SHA
states would have to repeat simultaneously.



More information about the Python-list mailing list