larger seeds for Mersenne

jt python at t011.com
Wed Feb 4 23:41:55 EST 2004


I'm trying to learn how to use a seed for the random module that is
larger than the integer produced by python's built-in hash(x) function. 
>From the documentation, it says:

"If x is not None or an int or long, hash(x) is used instead. If x is an
int or long, x is used directly."

So if I through something other than an int or long, it gets hashed down
to an int.  Which is what, 10 bytes or so?  So it seems like it would be
preferable to use something like md5 or sha to hash because then I'd get
16 or 20 bytes for the seed.  But the problem is that md5 and sha don't
hash to a long.  They include lots of other printable and nonprintable
characters.

Does anyone know of a hashing algorithm that hashes to a long that's
16-20+ bytes long?  Thanks for any help.

jt




More information about the Python-list mailing list