[tor-commits] [onionperf/master] Modify SHA-256 digest field in index.xml.

karsten at torproject.org karsten at torproject.org
Mon Jun 8 09:54:19 UTC 2020


commit 7b5e65dc0160314dd76000d5f98ce64278fd1543
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Mon Jun 8 11:50:30 2020 +0200

    Modify SHA-256 digest field in index.xml.
---
 onionperf/measurement.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/onionperf/measurement.py b/onionperf/measurement.py
index d4435f0..308305c 100644
--- a/onionperf/measurement.py
+++ b/onionperf/measurement.py
@@ -3,7 +3,8 @@
   Authored by Rob Jansen, 2015
   See LICENSE for licensing information
 '''
-import hashlib
+
+import binascii, hashlib
 import os, traceback, subprocess, threading, queue, logging, time, datetime, re, shlex
 from lxml import etree
 
@@ -29,7 +30,7 @@ def generate_docroot_index(docroot_path):
                 e.set("last_modified", mtime.replace(microsecond=0).isoformat(sep=' '))
                 with open(entry, 'rb') as f:
                     fbytes = f.read()
-                    e.set("sha256sum", hashlib.sha256(fbytes).hexdigest())
+                    e.set("sha256", binascii.b2a_base64(hashlib.sha256(fbytes).digest(), newline=False))
     with open("{0}/index.xml".format(docroot_path), 'wb') as f:
         et = etree.ElementTree(root)
         et.write(f, pretty_print=True, xml_declaration=True)



More information about the tor-commits mailing list