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
This commit is contained in:
Peter Šurda 2017-07-05 08:52:16 +02:00
parent 70c5929e92
commit 27f5de0f9c
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
1 changed files with 9 additions and 0 deletions

9
src/helper_random.py Normal file
View File

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