Created
February 3, 2014 13:03
-
-
Save zao/8783455 to your computer and use it in GitHub Desktop.
Python 2.4 implementation of Adler32 checksum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys,zlib | |
for filename in sys.argv[1:]: | |
try: | |
file = open(filename,'rb') | |
part_sum = 1; | |
while True: | |
buf = file.read(1024*128) | |
n = len(buf) | |
if n == 0: | |
break | |
part_sum = zlib.adler32(buf, part_sum) | |
print ("%08X %s" % (part_sum & 0xFFFFFFFF, filename)) | |
except IOError, (e): | |
sys.stderr.write('%s: %s: %s\n' % (sys.argv[0], filename, e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment