t.p.r.RandomFactory(object) : class documentation

Part of twisted.python.randbytes View 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 VariablesrandomSourceslist of file sources used when os.urandom is not available. (type: tuple )
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 _fileUrandom Wrapper around random file sources.
Method _randBits Wrapper around os.getrandbits.
Method _randRange Wrapper around random.randrange.
def _osUrandom(self, nbytes): (source)
Wrapper around os.urandom that cleanly manage its absence.
def _fileUrandom(self, nbytes): (source)

Wrapper around random file sources.

This method isn't meant to be call out of the class and could be removed arbitrarily.
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 _randRange(self, nbytes): (source)
Wrapper around random.randrange.
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 2011-10-27 16:27:37.