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

atagar at torproject.org atagar at torproject.org
Sun Mar 27 20:30:54 UTC 2016


commit 52f0d735b5158cc667019d136764d80ab77cb066
Author: Sebastian Hahn <sebastian at torproject.org>
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):



More information about the tor-commits mailing list