Change in pysim[master]: 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/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Oct 26 17:55:39 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/20922 )


Change subject: make random seed function python3 compatible
......................................................................

make random seed function python3 compatible

Change-Id: Iea8c93c20abe080eeb18026faeeb2668664871bb
---
M pySim-prog.py
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/22/20922/1

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 _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):

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/20922
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iea8c93c20abe080eeb18026faeeb2668664871bb
Gerrit-Change-Number: 20922
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201026/bf8acb6e/attachment.htm>


More information about the gerrit-log mailing list