diff options
author | Háčky <hatschky@gmail.com> | 2014-11-21 10:46:12 +0000 |
---|---|---|
committer | Háčky <hatschky@gmail.com> | 2014-11-21 10:46:12 +0000 |
commit | 2375d2c8db10447ae301176a2136bcad4bb42bb0 (patch) | |
tree | 00ca01a39e7bce0795a10b0c58f33e005ad4ef4c /scripts/trainerchecksum.py | |
parent | 92c6af6c354d58d96d9590efee955e449a8f94c3 (diff) |
Initial commit
Diffstat (limited to 'scripts/trainerchecksum.py')
-rw-r--r-- | scripts/trainerchecksum.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/trainerchecksum.py b/scripts/trainerchecksum.py new file mode 100644 index 0000000..78d7ffa --- /dev/null +++ b/scripts/trainerchecksum.py @@ -0,0 +1,13 @@ +import struct +import sys + +out = open(sys.argv[2], 'w') +sum = 0 +with open(sys.argv[1], 'rb') as f: + buf = f.read() + data = struct.unpack('<IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII', buf) + for word in data: + sum = (sum + word) % 2**32 +f.closed +out.write(buf) +out.write(struct.pack('<I', sum))
\ No newline at end of file |