aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Herbert <jeremy.006@gmail.com>2020-10-25 20:56:05 +1000
committerHarald Welte <laforge@osmocom.org>2020-10-26 18:55:25 +0100
commit3b00dbf0d232e1e6616a2d014a7eeeb84738af22 (patch)
treeb8caf6c6f2b0de187542108d058941ec00a6b74d
parent95ec772b61c9f8c7514d92a8f434706759bfb787 (diff)
make random seed function python3 compatible
-rwxr-xr-xpySim-prog.py5
1 files 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):