mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-16 18:38:32 +03:00
make random seed function python3 compatible
Change-Id: Iea8c93c20abe080eeb18026faeeb2668664871bb
This commit is contained in:
committed by
Harald Welte
parent
95ec772b61
commit
3b00dbf0d2
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user