Created
January 16, 2012 09:35
-
-
Save syshack/1619990 to your computer and use it in GitHub Desktop.
crc
This file contains hidden or 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 os, sys | |
import zlib | |
import base64 | |
filename = sys.argv[1] | |
def crc(fileName): | |
fd = open(fileName,"rb") | |
content = fd.readlines() | |
fd.close() | |
prev = None | |
for eachLine in content: | |
if not prev: | |
prev = zlib.crc32(eachLine) | |
else: | |
prev = zlib.crc32(eachLine, prev) | |
return prev | |
for eachFile in sys.argv[1:]: | |
print base64.b64encode(str(crc(eachFile))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment