[PATCH] D68104: [LNT] Python 3 support: adapt secret computation

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 6 14:54:24 PDT 2019


hubert.reinterpretcast added inline comments.


================
Comment at: lnt/lnttool/create.py:140
     secret_key = (secret_key or
-                  hashlib.sha1(str(random.getrandbits(256))).hexdigest())
+                  binascii.hexlify(os.urandom(20)).decode('ascii'))
 
----------------
Being no security expert, I am not sure about the patch. I do see that `getrandbits` is documented as not being for security purposes, but I think we can do the Python 3 support without changing the status quo of the "security".

With the `future` package:
```
from builtins import bytes
hashlib.sha1(bytes(str(random.getrandbits(256)), encoding='ascii')).hexdigest()
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68104/new/

https://reviews.llvm.org/D68104





More information about the llvm-commits mailing list