summaryrefslogtreecommitdiff
path: root/scripts/berrychecksum.py
blob: a973dc28c47cb50a9de44e1a634b1cba79a80711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import struct
import sys

out = open(sys.argv[2], 'w')
sum = 0
with open(sys.argv[1], 'rb') as f:
	while True:
		byte = f.read(1)
		if not byte:
			break

		sum += ord(byte)
		out.write(byte)
f.closed

out.write(struct.pack('<I', sum))