mv os.urandom sanity check to main __init__.py
cool check but I am going to delete rsakey.py
This commit is contained in:
@@ -46,3 +46,10 @@ except AssertionError:
|
|||||||
else:
|
else:
|
||||||
raise ImportError("Running with asserts disabled. Refusing to continue. Exiting...")
|
raise ImportError("Running with asserts disabled. Refusing to continue. Exiting...")
|
||||||
|
|
||||||
|
|
||||||
|
# Check that os.urandom works
|
||||||
|
import zlib
|
||||||
|
length = len(zlib.compress(os.urandom(1000)))
|
||||||
|
if length <= 900:
|
||||||
|
raise ImportError("Broken PRNG. Refusing to continue. Exiting...")
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,6 @@ def SHA1(x):
|
|||||||
# PRNG Functions
|
# PRNG Functions
|
||||||
# **************************************************************************
|
# **************************************************************************
|
||||||
|
|
||||||
# Check that os.urandom works
|
|
||||||
import zlib
|
|
||||||
length = len(zlib.compress(os.urandom(1000)))
|
|
||||||
assert length > 900
|
|
||||||
|
|
||||||
def getRandomBytes(howMany):
|
def getRandomBytes(howMany):
|
||||||
b = bytearray(os.urandom(howMany))
|
b = bytearray(os.urandom(howMany))
|
||||||
|
|||||||
Reference in New Issue
Block a user