Skip to content

Instantly share code, notes, and snippets.

@reflechant
Last active August 10, 2016 07:15
Show Gist options
  • Save reflechant/bf9fc86fd3130bf931dbcc01b44f41d5 to your computer and use it in GitHub Desktop.
Save reflechant/bf9fc86fd3130bf931dbcc01b44f41d5 to your computer and use it in GitHub Desktop.
Get CRC32 checksum of a file
#!/usr/bin/env python
import sys
import zlib
def main():
with open(sys.argv[1], 'rb') as f:
data = f.read()
print(hex(zlib.crc32(data)))
if len(sys.argv) == 2:
main()
else:
print("Please, point a file name to calculate CRC32 checksum")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment