forked from shaba/openuds
Added parameter to add or not digits on random string
This commit is contained in:
parent
df86e8742c
commit
5e177059fe
@ -225,5 +225,6 @@ class CryptoManager:
|
||||
|
||||
return str(uuid.uuid5(self._namespace, obj)).lower() # I believe uuid returns a lowercase uuid always, but in case... :)
|
||||
|
||||
def randomString(self, length: int = 40) -> str:
|
||||
return ''.join(random.SystemRandom().choices(string.ascii_lowercase + string.digits, k=length))
|
||||
def randomString(self, length: int = 40, digits: bool = True) -> str:
|
||||
base = string.ascii_lowercase + (string.digits if digits else '')
|
||||
return ''.join(random.SystemRandom().choices(base, k=length))
|
||||
|
Loading…
Reference in New Issue
Block a user