aboutsummaryrefslogtreecommitdiff
path: root/crcdiag.py
blob: e7eaae7ba6e3411d8e7fb2ca99ce9bdad8be136d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import sys
import zlib

h = open(sys.argv[1], mode="rb")
contents = h.read(-1)
compressedContents = zlib.compress(contents)
goal = int(sys.argv[2])

for i in range(0, 0x100000000):
    if zlib.crc32(contents, i) == goal:
        print("CRC32: %d matches" % i)
    if zlib.adler32(contents, i) == goal:
        print("Adler32: %d matches" % i)
    if i & 0xFFFFF == 0:
        print("Progress: %d" % i)