doing "checksum" in python

Irmen de Jong irmen.NOSPAM at xs4all.nl
Mon Mar 28 17:20:25 EST 2005


GujuBoy wrote:
> is there a built-in function that does a "checksum" on a file...basicly
> counts the bytes and computes a 16-bit checksum for each given FILE.
> 
> this is the like the "sum" command in unix
> 


Try zlib.adler32 or zlib.crc32 ...?

>>> import zlib
>>> zlib.crc32(open("c:\\boot.ini").read())
-1176164168

--Irmen



More information about the Python-list mailing list