Factory providing secureRandom and insecureRandom methods.

You shouldn't have to instantiate this class, use the module level functions instead: it is an implementation detail and could be removed or changed arbitrarily.

Method secureRandom Return a number of secure random bytes.
Method insecureRandom Return a number of non secure random bytes.
Method _osUrandom Wrapper around os.urandom that cleanly manage its absence.
Method _randBits Wrapper around os.getrandbits.
Method _randModule 0 Wrapper around the random module.
Method _randModule Wrapper around the random module.
def _osUrandom(self, nbytes): (source)

Wrapper around os.urandom that cleanly manage its absence.

def secureRandom(self, nbytes, fallback=False): (source)

Return a number of secure random bytes.

Parametersnbytesnumber of bytes to generate. (type: int)
fallbackWhether the function should fallback on non-secure random or not. Default to False. (type: bool)
Returnsa string of random bytes. (type: str)
def _randBits(self, nbytes): (source)

Wrapper around os.getrandbits.

def _randModule 0(self, nbytes): (source)

Wrapper around the random module.

def _randModule(self, nbytes): (source)

Wrapper around the random module.

def insecureRandom(self, nbytes): (source)

Return a number of non secure random bytes.

Parametersnbytesnumber of bytes to generate. (type: int)
Returnsa string of random bytes. (type: str)
API Documentation for Twisted, generated by pydoctor at 2017-09-23 19:45:03.