aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm/cryptech_upload
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2020-05-26 15:18:35 -0400
committerRob Austein <sra@hactrn.net>2020-05-26 15:18:35 -0400
commit6d797bffbd7571df98198df26977a39b86630ac7 (patch)
treed270af05d27bf746b4f4ba30a98542d93002f84f /projects/hsm/cryptech_upload
parentf948d674351a2ca87d33c0e0d8558cbbb2f59682 (diff)
Wow, python-version-independent hexadecimal is painful
Diffstat (limited to 'projects/hsm/cryptech_upload')
-rwxr-xr-xprojects/hsm/cryptech_upload7
1 files changed, 5 insertions, 2 deletions
diff --git a/projects/hsm/cryptech_upload b/projects/hsm/cryptech_upload
index 0c18f25..aaa0f1c 100755
--- a/projects/hsm/cryptech_upload
+++ b/projects/hsm/cryptech_upload
@@ -44,7 +44,7 @@ import tarfile
import argparse
import platform
-from binascii import crc32
+from binascii import crc32, hexlify
FIRMWARE_CHUNK_SIZE = 4096
FPGA_CHUNK_SIZE = 4096
@@ -147,7 +147,10 @@ class ManagementPortAbstract(object):
data = struct.pack("<I", data)
self.send(data)
if self.args.debug:
- print("Wrote {!r}".format(data))
+ if numeric:
+ print("Wrote 0x{}".format(hexlify(data).decode("ascii")))
+ else:
+ print("Wrote {!r}".format(data))
def read(self):
res = b""