]> git.tnoah.ca Git - lora-radio.git/commitdiff
Added partition hash gen tool
authorMark Qvist <mark@unsigned.io>
Tue, 1 Nov 2022 21:06:38 +0000 (22:06 +0100)
committerMark Qvist <mark@unsigned.io>
Tue, 1 Nov 2022 21:06:38 +0000 (22:06 +0100)
partition_hashes [new file with mode: 0755]

diff --git a/partition_hashes b/partition_hashes
new file mode 100755 (executable)
index 0000000..b3c8dac
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/python
+import os
+import sys
+import RNS
+import json
+import hashlib
+
+major_version = None
+minor_version = None
+target_version = None
+
+target_file = os.path.join(sys.argv[1])
+
+firmware_data = open(target_file, "rb").read()
+calc_hash = hashlib.sha256(firmware_data[0:-32]).digest()
+part_hash = firmware_data[-32:]
+
+if calc_hash == part_hash:
+    print(RNS.hexrep(part_hash, delimit=False))
\ No newline at end of file