make random seed function python3 compatible

Change-Id: Iea8c93c20abe080eeb18026faeeb2668664871bb
This commit is contained in:
Jeremy Herbert 2020-10-25 20:56:05 +10:00 committed by Harald Welte
parent 95ec772b61
commit 3b00dbf0d2
1 changed files with 3 additions and 2 deletions

View File

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