[rtems-tools commit] tester: Use shorter SHA512 encoding

Sebastian Huber sebh at rtems.org
Fri Aug 11 05:28:31 UTC 2023


Module:    rtems-tools
Branch:    master
Commit:    c05c4a9cbfbfce77fbd2469282b614d9c8f5e111
Changeset: http://git.rtems.org/rtems-tools/commit/?id=c05c4a9cbfbfce77fbd2469282b614d9c8f5e111

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Aug 10 15:50:53 2023 +0200

tester: Use shorter SHA512 encoding

Encode the SHA512 digest in base64urlsafe instead of a hex string to
reduce the report size.

---

 tester/rt/test.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tester/rt/test.py b/tester/rt/test.py
index 2b5ad85..0e22002 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -329,13 +329,14 @@ def generate_yaml_report(args, reports, start_time, end_time,
 
 def get_hash512(exe):
     """ returns SHA512 hash string of a given binary file passed as argument """
+    import base64
     import hashlib
 
     hash = hashlib.sha512()
     with open(exe, "rb") as f:
         for byte_block in iter(lambda: f.read(4096), b""):
             hash.update(byte_block)
-    return hash.hexdigest()
+    return base64.urlsafe_b64encode(hash.digest()).decode("ascii")
 
 
 report_formatters = {



More information about the vc mailing list