diff options
author | Vladimir Serov <me@cab404.ru> | 2021-09-16 01:31:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 18:31:47 -0400 |
commit | 4b5d1c85c01db789da08390f7c87799d5fd7cf51 (patch) | |
tree | 57fc821c9fa2ff13977fe6eca82e5bdfcbc888b9 /scripts/update_chitu.py | |
parent | 8cf1b512233857ec74a4a8fb9ed3245b3daac84b (diff) | |
download | kutter-4b5d1c85c01db789da08390f7c87799d5fd7cf51.tar.gz kutter-4b5d1c85c01db789da08390f7c87799d5fd7cf51.tar.xz kutter-4b5d1c85c01db789da08390f7c87799d5fd7cf51.zip |
update_chitu: generating update uuid based on file hash (#4663)
This makes update_chitu a pure function: same file in — same file out.
That's something I need to make Nix builds for firmware itself reproducible.
Signed-off-by: Vladimir Serov <me@cab404.ru>
Diffstat (limited to 'scripts/update_chitu.py')
-rwxr-xr-x | scripts/update_chitu.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/update_chitu.py b/scripts/update_chitu.py index 2da78276..1d993b46 100755 --- a/scripts/update_chitu.py +++ b/scripts/update_chitu.py @@ -6,10 +6,10 @@ # Licensed under GPL-3.0 import os -import random import struct import uuid import sys +import hashlib def calculate_crc(contents, seed): accumulating_xor_value = seed; @@ -69,7 +69,9 @@ def encode_file(input, output_file, file_length): block_size = 0x800 key_length = 0x18 - uid_value = uuid.uuid4() + file_digest = hashlib.md5(input_file).digest() + uid_value = uuid.UUID(bytes=file_digest) + print("Update UUID ", uid_value) file_key = int(uid_value.hex[0:8], 16) xor_crc = 0xef3d4323; |