Check hash of original script file
This commit is contained in:
parent
c195be34a0
commit
a4d9c44c0e
|
@ -1,8 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
import hashlib
|
||||||
|
|
||||||
def open_onikakushi() -> str:
|
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'
|
outpath = 'tmp/onikakushi.txt'
|
||||||
origfile = open(config.get('original_path'), 'r', encoding='shift_jisx0213')
|
origfile = open(config.get('original_path'), 'r', encoding='shift_jisx0213')
|
||||||
outfile = open(outpath, 'w', encoding='shift_jisx0213')
|
outfile = open(outpath, 'w', encoding='shift_jisx0213')
|
||||||
|
|
Loading…
Reference in New Issue