Skip to content

Instantly share code, notes, and snippets.

@Zer0xFF
Created February 17, 2020 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zer0xFF/523623b188ecea6b298d8b70c2b95ac0 to your computer and use it in GitHub Desktop.
Save Zer0xFF/523623b188ecea6b298d8b70c2b95ac0 to your computer and use it in GitHub Desktop.
Verify Collection Of PS2 Dumps Against Redump
#!/usr/bin/env python3
# pip3 install --user filehash untangle
import os
import untangle
from filehash import FileHash
obj = untangle.parse('redump.ps2.dat')
hashes = set()
for game in obj.datafile.game:
for rom in game.rom:
hashes.add(rom['crc'])
obj = None
path = 'G:\\PS2ISO\\'
files = []
for r, d, f in os.walk(path):
for file in f:
files.append(os.path.join(r, file))
invalidCrc = []
crc32hasher = FileHash('crc32')
for file in files:
print("Processing {}".format(file), end = '', flush=True)
crc = crc32hasher.hash_file(file).casefold()
print(" - CRC {}".format(crc), end = '', flush=True)
if(crc in hashes):
print(" - Valid", flush=True)
else:
print(" - Invalid", flush=True)
invalidCrc.append(file)
print("Invalid Dumps", invalidCrc)
@Yagami2002
Copy link

Zer0xFF:flatpak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment