# HG changeset patch # User Paper <37962225+mrpapersonic@users.noreply.github.com> # Date 1623928970 14400 # Node ID 349c9636d8ca766bdc5ee2effa15bb4dd1021cb2 # Parent fdbafd3e86d9c3c57339fd2d551b3ef11a00e134 Create sfv.py committer: GitHub diff -r fdbafd3e86d9 -r 349c9636d8ca sfv.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sfv.py Thu Jun 17 07:22:50 2021 -0400 @@ -0,0 +1,22 @@ +import os, sys, zlib + +def crc(filename): return "%X"%(zlib.crc32(open(filename,"rb").read()) & 0xFFFFFFFF) + +try: + temp = sys.argv[1] +except: + print("No file specified!") + sys.exit() + +f = open(sys.argv[1]) +lines = f.readlines() +f.close() + +for line in lines: + if not line[0] == ";": + crc32 = line.strip()[-8:] + name = line.strip()[:-8] + if crc(name).zfill(8) == crc32: + print(f"{name}: CRC hash match!") + else: + print(f"{name}: CRC hash does not match!")