2019-12-08 22:43:49 +01:00
|
|
|
import random
|
|
|
|
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
def random_hex_string(length: int, caps: bool = False) -> str:
|
2019-12-08 22:43:49 +01:00
|
|
|
if caps:
|
2022-10-15 20:56:30 +02:00
|
|
|
string = "0123456789ABCDEF"
|
2019-12-08 22:43:49 +01:00
|
|
|
else:
|
2022-10-15 20:56:30 +02:00
|
|
|
string = "0123456789abcdef"
|
|
|
|
return "".join([random.choice(string) for x in range(length)])
|