class documentation
class RandomFactory: (source)
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 | insecure |
Return a number of non secure random bytes. |
| Method | secure |
Return a number of secure random bytes. |
| Class Variable | random |
Undocumented |
| Method | _os |
Wrapper around os.urandom that cleanly manage its absence. |
| Method | _rand |
Wrapper around os.getrandbits. |
| Method | _rand |
Wrapper around the random module. |
| Constant | _BYTES |
Undocumented |
Return a number of non secure random bytes.
| Parameters | |
| nbytes:int | number of bytes to generate. |
| Returns | |
| str | a string of random bytes. |
Return a number of secure random bytes.
| Parameters | |
| nbytes:int | number of bytes to generate. |
| fallback:bool | Whether the function should fallback on non-secure random or not. Default to False. |
| Returns | |
| str | a string of random bytes. |