PyBitmessage-2021-04-27/src/helper_random.py
Peter Surda 27f5de0f9c
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
2017-07-05 08:52:16 +02:00

10 lines
172 B
Python

import os
from pyelliptic.openssl import OpenSSL
def randomBytes(n):
try:
return os.urandom(n)
except NotImplementedError:
return OpenSSL.rand(n)