hash() algorithm

David Bolen db3l at fitlinxx.com
Wed Jul 21 16:34:16 EDT 2004


Benoît Dejean <bnet at ifrance.com> writes:

> i need to use a ~checksum function, like md5, but i was also thinking
> about hash() which is obviously simpler. So i can safely rely on hash()
> behaviour so i can use it to generate ~strong and portable
> identifier/checksum ?

I don't believe it's changed since at least 1.5.2, but I'm also pretty
sure there are no guarantees that it will remain the same going forward.

Also, how strong do you want your checksum to be?  That is, how much
of a guarantee do you want that you'll be able to detect a change in
the data by a change in the checksum?  MD5 will give you a really
strong guarantee, hash() - whether stable/portable or not - will give
you a reasonably weak guarantee since it's not built to be collision
free.

-- David



More information about the Python-list mailing list