Skip to content

Instantly share code, notes, and snippets.

@ekapujiw2002
Forked from matteomattei/crc32.py
Created June 26, 2021 01:18
Show Gist options
  • Save ekapujiw2002/bd9c463f9161ad00582832648c8dfcc5 to your computer and use it in GitHub Desktop.
Save ekapujiw2002/bd9c463f9161ad00582832648c8dfcc5 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