From 27f5de0f9cba114004ef9aa49a541dbc07b9a94c Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Wed, 5 Jul 2017 08:52:16 +0200 Subject: [PATCH] Unified random number provider - not used yet, just an inactive helper function - I received feedback that OpenSSL.rand isn't more secure than os.urandom. I read several debates/analyses about it and concur --- src/helper_random.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/helper_random.py diff --git a/src/helper_random.py b/src/helper_random.py new file mode 100644 index 00000000..a0fb08f1 --- /dev/null +++ b/src/helper_random.py @@ -0,0 +1,9 @@ +import os + +from pyelliptic.openssl import OpenSSL + +def randomBytes(n): + try: + return os.urandom(n) + except NotImplementedError: + return OpenSSL.rand(n)