Return random numbers safe for cryptographic use
If your system provides /dev/urandom there is no need for any configuration.
If you want to use another random source, add the following to the
The source need to be a socket that returns a stream of bytes. If
you set location to the empty string, the class will use the system tokens
get_random call instead.
The call expects three positional parameters:
- Int random number of bytes
- The number of random bytes, this is NOT the length of the string received.
This argument is mandatory.
- The encoding of the returned data. The default is base64.
- The default uses /dev/urandom which should be sufficient for everyday use
such as passwords or UUIDs. fast might return insecure numbers,
string will call the default tokens create_random method
which calls openssl rand which CAN be setup using an engine / HSM.
Note: fast has currently no extra implementation and uses