mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-24 13:41:14 -05:00
use hash of /dev/urandom data instead of urandom data directly, to avoid leaking state of entropy
This commit is contained in:
parent
d9aa55b991
commit
7a05516a65
@ -18,7 +18,8 @@ class NoTor(Exception):
|
||||
|
||||
def random_string(num_bytes):
|
||||
b = os.urandom(num_bytes)
|
||||
return base64.b32encode(b).lower().replace('=','')
|
||||
h = hashlib.sha256(b).digest()[:16]
|
||||
return base64.b32encode(h).lower().replace('=','')
|
||||
|
||||
def get_platform():
|
||||
p = platform.system()
|
||||
|
Loading…
Reference in New Issue
Block a user