[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Use a real random generator instead of time.time()



commit 52f0d735b5158cc667019d136764d80ab77cb066
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date:   Sun Mar 27 22:19:16 2016 +0200

    Use a real random generator instead of time.time()
    
    Fixes spurious issues in the integration tests, ticket #8865.
---
 test/integ/control/controller.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 7f9edd3..d5c2ec1 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -47,7 +47,7 @@ def random_fingerprint():
   Provides a random 40 character hex string.
   """
 
-  return hashlib.sha1(stem.util.str_tools._to_bytes(str(time.time()))).hexdigest().upper()
+  return hashlib.sha1(os.urandom(20)).hexdigest().upper()
 
 
 class TestController(unittest.TestCase):

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits