Check hash of original script file

This commit is contained in:
Dusk 2024-02-23 20:16:35 +01:00
parent c195be34a0
commit a4d9c44c0e
1 changed files with 8 additions and 0 deletions

View File

@ -1,8 +1,16 @@
#!/usr/bin/env python3
import config
import hashlib
def open_onikakushi() -> str:
with open(config.get('original_path'), 'rb') as f:
md5hash = "248cc760eb112d1fac1e42cdc4e5ef6f"
digest = hashlib.file_digest(f, "md5")
if digest.hexdigest() != md5hash:
raise Exception("Original script hashes do not match")
outpath = 'tmp/onikakushi.txt'
origfile = open(config.get('original_path'), 'r', encoding='shift_jisx0213')
outfile = open(outpath, 'w', encoding='shift_jisx0213')