MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / rand

Method rand

src/lib/pyelliptic/openssl.py:468–482  ·  view source on GitHub ↗

OpenSSL random function

(self, size)

Source from the content-addressed store, hash-verified

466 return res
467
468 def rand(self, size):
469 """
470 OpenSSL random function
471 """
472 buffer = self.malloc(0, size)
473 # This pyelliptic library, by default, didn't check the return value of RAND_bytes. It is
474 # evidently possible that it returned an error and not-actually-random data. However, in
475 # tests on various operating systems, while generating hundreds of gigabytes of random
476 # strings of various sizes I could not get an error to occur. Also Bitcoin doesn't check
477 # the return value of RAND_bytes either.
478 # Fixed in Bitmessage version 0.4.2 (in source code on 2013-10-13)
479 while self.RAND_bytes(buffer, size) != 1:
480 import time
481 time.sleep(1)
482 return buffer.raw
483
484 def malloc(self, data, size):
485 """

Callers 4

pbkdf2Function · 0.80
gen_IVMethod · 0.80
raw_encryptMethod · 0.80
eciesEncryptFunction · 0.80

Calls 1

mallocMethod · 0.95

Tested by

no test coverage detected