class documentation

class 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.

Method insecureRandom Return a number of non secure random bytes.
Method secureRandom Return a number of secure random bytes.
Class Variable randomSources Undocumented
Method _osUrandom Wrapper around os.urandom that cleanly manage its absence.
Method _randBits Wrapper around os.getrandbits.
Method _randModule Wrapper around the random module.
Class Variable _BYTES Undocumented
def insecureRandom(self, nbytes): (source)
Return a number of non secure random bytes.
Parameters
nbytes:intnumber of bytes to generate.
Returns
stra string of random bytes.
def secureRandom(self, nbytes, fallback=False): (source)
Return a number of secure random bytes.
Parameters
nbytes:intnumber of bytes to generate.
fallback:boolWhether the function should fallback on non-secure random or not. Default to False.
Returns
stra string of random bytes.
randomSources: tuple = (source)

Undocumented

def _osUrandom(self, nbytes): (source)
Wrapper around os.urandom that cleanly manage its absence.
def _randBits(self, nbytes): (source)
Wrapper around os.getrandbits.
def _randModule(self, nbytes): (source)
Wrapper around the random module.
_BYTES = (source)

Undocumented