RandomHexDigitSource: rather return in string format, not bytes

Change-Id: I4e86289f6fb72cbd4cf0c90b8b49538cfab69a7f
This commit is contained in:
Neels Hofmeyr
2025-08-05 03:18:27 +02:00
parent 9e33ae0486
commit 3bee435c2a

View File

@@ -19,6 +19,7 @@
import random
import re
from osmocom.utils import b2h
class ParamSourceExn(Exception):
pass
@@ -143,7 +144,7 @@ class RandomHexDigitSource(InputExpandingParamSource):
def get_next(self, csv_row:dict=None):
val = random.randbytes(self.num_digits // 2) # TODO secure random source?
return val
return b2h(val)
@classmethod
def from_str(cls, s:str):