Last active
August 10, 2016 07:15
-
-
Save reflechant/bf9fc86fd3130bf931dbcc01b44f41d5 to your computer and use it in GitHub Desktop.
Get CRC32 checksum of a file
This file contains 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 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