You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
306 B
Python
14 lines
306 B
Python
import sys
|
|
import struct
|
|
|
|
with open(sys.argv[1], mode='rb') as file:
|
|
file.read(4) # discard first four bytes
|
|
rombin = file.read() # read rest of file
|
|
cksum = 0
|
|
count = 0;
|
|
for i in struct.unpack('>' + str(len(rombin)/2) + 'H', rombin):
|
|
cksum += i
|
|
count += 1
|
|
cksum &= 0xFFFFFFFF
|
|
print(hex(cksum))
|