19 lines
579 B
Python
19 lines
579 B
Python
import hashlib
|
|
import struct
|
|
|
|
with open("main", "rb") as f:
|
|
data = f.read()
|
|
|
|
hash1 = hashlib.sha256(data[0x2000 : 0x2000 + 0x5334D]).digest()
|
|
hash2 = hashlib.sha256(data[0x56000 : 0x56000 + 0x226BB]).digest()
|
|
|
|
with open("./romfs/map", "wb") as f:
|
|
f.write(struct.pack("<Q", 0x5334D)) # region 1 size
|
|
f.write(struct.pack("<Q", 0x226BB)) # region 2 size
|
|
f.write(hash1) # 32 bytes
|
|
f.write(hash2) # 32 bytes
|
|
|
|
print("map written")
|
|
print(f" region1 hash: {hash1.hex()}")
|
|
print(f" region2 hash: {hash2.hex()}")
|