SHA-based subclass for random module
Josiah Carlson
jcarlson at nospam.uci.edu
Fri Mar 19 13:01:04 EST 2004
> What's Random.random(self) supposed to do?
Generate a random number using the Mersenne Twister random number generator.
>> ciphertxt = md5.new(plaintxt).digest()
>
> I think you mean update.
Perhaps yes, perhaps no. Certainly the digest of both are dependant on
two inputs (the current internal state of MD5 and the random number
generated by MT). However, unless you can store the series of updates
to MD5, then getstate() followed by setstate() would not be sufficient
to get the same series of random numbers. This is also a "possible
issue" shared by the double-sha algorithm.
> But doesn't support all the operations specified in the Random API.
> What's up with that?
That is what the subclass was for:
> class MD5Random(Random):
- Josiah
More information about the Python-list
mailing list