Skip to content

Instantly share code, notes, and snippets.

@syshack
Created January 16, 2012 09:35
Show Gist options
  • Save syshack/1619990 to your computer and use it in GitHub Desktop.
Save syshack/1619990 to your computer and use it in GitHub Desktop.
crc
#!/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