pylibressl.rand¶
Random number generation.
When used with LibreSSL, it uses arc4random algorithm based on ChaCha.
Usage example:
>>> # We want to get 32 bytes from PRNG
>>> from pylibressl.rand import get_random_bytes
>>> random = get_random_bytes(32)
Submodules¶
Package Contents¶
Functions¶
|
Get a string of random bytes with specified length. |
|
Get a string of random bytes with specified length. |
|
Get an integer containing bit_number random bits. |
- pylibressl.rand.get_random_bytes(length)¶
Get a string of random bytes with specified length.
Uses system PRNG provided by Python.
- pylibressl.rand.libressl_get_random_bytes(length)¶
Get a string of random bytes with specified length.
Uses LibreSSL PRNG (system source + arc4random).
- pylibressl.rand.getrandbits(bit_number)¶
Get an integer containing bit_number random bits.
Analogous to Crypto.Random.random.getrandbits from pycrypto.