hash() algorithm

Christopher T King squirrel at WPI.EDU
Thu Jul 22 09:00:35 EDT 2004

On Wed, 21 Jul 2004, [iso-8859-1] Benoît Dejean wrote:

> i need to use a ~checksum function, like md5, but i was also thinking
> about hash() which is obviously simpler.

md5 is actually very easy to use on Python:

>>> import md5
>>> chksum=md5.new('apple')
>>> chksum.hexdigest()
>>> int(chksum.hexdigest())

This is a little more verbose than hash(), but it's just as
straightforward, and can more easily be used with large messages (see the 
.update() method of the md5 object returned by new()).

More information about the Python-list mailing list