[PATCH 1/1] make random seed function python3 compatible

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jeremy Herbert jeremy.006 at gmail.com
Sun Oct 25 10:56:05 UTC 2020


---
 pySim-prog.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pySim-prog.py b/pySim-prog.py
index 942cfb0..e172d80 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -225,8 +225,9 @@ def parse_options():
 
 
 def _digits(secret, usage, len, num):
-	s = hashlib.sha1(secret + usage + '%d' % num)
-	d = ''.join(['%02d'%ord(x) for x in s.digest()])
+	seed = secret + usage + '%d' % num
+	s = hashlib.sha1(seed.encode())
+	d = ''.join(['%02d' % x for x in s.digest()])
 	return d[0:len]
 
 def _mcc_mnc_digits(mcc, mnc):
-- 
2.25.1




More information about the OpenBSC mailing list