class documentation

class twisted.python.randbytes.RandomFactory: (source)

View In Hierarchy

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.

Class Variable randomSources Undocumented
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.
Class Variable _BYTES Undocumented
Method _randModule Wrapper around the random module.
randomSources = (source)

Undocumented

(type: tuple)
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.

_BYTES = (source)

Undocumented

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 20.12.1 at 2021-02-28 19:53:36.