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):

Wrapper around os.urandom that cleanly manage its absence.

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

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):

Wrapper around os.getrandbits.

def _randModule 0(self, nbytes):

Wrapper around the random module.

def _randModule(self, nbytes):

Wrapper around the random module.

def insecureRandom(self, nbytes):

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 2020-03-25 17:34:30.