1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 00:08:10 +00:00

build: fix fprint calculation in build.sh

This commit is contained in:
Pavol Rusnak 2018-06-22 15:01:47 +02:00
parent e96101e72a
commit e0b64b151d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -44,10 +44,16 @@ from __future__ import print_function
import hashlib import hashlib
import sys import sys
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
(fn, max_size) = arg.split(':') (fn, fprint_start, hashing, max_size) = arg.split(':')
fprint_start = int(fprint_start)
max_size = int(max_size)
data = open(fn, 'rb').read() data = open(fn, 'rb').read()
if hashing == 'd':
fprint = hashlib.sha256(hashlib.sha256(data[fprint_start:]).digest()).hexdigest()
else:
fprint = hashlib.sha256(data[fprint_start:]).hexdigest()
print('\n\n') print('\n\n')
print('Filename :', fn) print('Filename :', fn)
print('Fingerprint :', hashlib.sha256(hashlib.sha256(data).digest()).hexdigest()) print('Fingerprint :', fprint)
print('Size : %d bytes (out of %d maximum)' % (len(data), int(max_size, 10))) print('Size : %d bytes (out of %d maximum)' % (len(data), max_size))
" $BOOTLOADER_BINFILE:32768 $FIRMWARE_BINFILE:491520 " $BOOTLOADER_BINFILE:0:d:32768 $FIRMWARE_BINFILE:256:s:491520