mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-25 23:08:34 +03:00
RandomHexDigitSource: rather return in string format, not bytes
Change-Id: I4e86289f6fb72cbd4cf0c90b8b49538cfab69a7f
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
from osmocom.utils import b2h
|
||||||
|
|
||||||
class ParamSourceExn(Exception):
|
class ParamSourceExn(Exception):
|
||||||
pass
|
pass
|
||||||
@@ -143,7 +144,7 @@ class RandomHexDigitSource(InputExpandingParamSource):
|
|||||||
|
|
||||||
def get_next(self, csv_row:dict=None):
|
def get_next(self, csv_row:dict=None):
|
||||||
val = random.randbytes(self.num_digits // 2) # TODO secure random source?
|
val = random.randbytes(self.num_digits // 2) # TODO secure random source?
|
||||||
return val
|
return b2h(val)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_str(cls, s:str):
|
def from_str(cls, s:str):
|
||||||
|
|||||||
Reference in New Issue
Block a user