Update checksum.py
This commit is contained in:
parent
8cb07a3f77
commit
6f31d0a824
|
@ -5,7 +5,9 @@ with open(sys.argv[1], mode='rb') as file:
|
||||||
file.read(4) # discard first four bytes
|
file.read(4) # discard first four bytes
|
||||||
rombin = file.read() # read rest of file
|
rombin = file.read() # read rest of file
|
||||||
cksum = 0
|
cksum = 0
|
||||||
|
count = 0;
|
||||||
for i in struct.unpack('>' + str(len(rombin)/2) + 'H', rombin):
|
for i in struct.unpack('>' + str(len(rombin)/2) + 'H', rombin):
|
||||||
cksum += i;
|
cksum += i
|
||||||
|
count += 1
|
||||||
cksum &= 0xFFFFFFFF
|
cksum &= 0xFFFFFFFF
|
||||||
print(hex(cksum))
|
print(hex(cksum))
|
||||||
|
|
Loading…
Reference in New Issue