Question regarding checksuming of a file

Andrew Robert andrew.arobert at gmail.com
Sat May 13 21:55:13 EDT 2006


Roy Smith wrote:
>>
>> However this does not appear to be actually returning the checksum.
>>
>> Does anyone have insight into where I am going wrong?
> 
> After calling update(), you need to call digest().  Update() only updates 
> the internal state of the md5 state machine; digest() returns the hash.  
> Also, for the code above, it's m.update(), not md5.update().  Update() is a 
> method of an md5 instance object, not the md5 module itself.
> 
> Lastly, the md5 algorithm is known to be weak.  If you're doing md5 to 
> maintain compatability with some pre-existing implementation, that's one 
> thing.  But, if you're starting something new from scratch, I would suggest 
> using SHA-1 instead (see the sha module).  SHA-1 is much stronger 
> cryptographically than md5.  The Python API is virtually identical, so it's 
> no added work to switch to the stronger algorithm.

Hi Roy,

This is strictly for checking if a file was corrupted during transit
over an MQSeries channel.

The check is not intended to be used for crypto purposes.



More information about the Python-list mailing list