use hash of /dev/urandom data instead of urandom data directly, to avoid leaking state of entropy

This commit is contained in:
Micah Lee 2014-07-15 19:17:09 -07:00
parent d9aa55b991
commit 7a05516a65

View File

@ -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()