Skip to content

Instantly share code, notes, and snippets.

@matteomattei
Created July 8, 2014 07:52
Show Gist options
  • Save matteomattei/160c1198682e92f6f2a0 to your computer and use it in GitHub Desktop.
Save matteomattei/160c1198682e92f6f2a0 to your computer and use it in GitHub Desktop.
Calculate CRC32 of a file in Python
#!/usr/bin/env python
import binascii
def CRC32_from_file(filename):
buf = open(filename,'rb').read()
buf = (binascii.crc32(buf) & 0xFFFFFFFF)
return "%08X" % buf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment