This repository has been archived on 2024-12-13. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-13/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)