(PHP 7)
random_bytes — Generates cryptographically secure pseudo-random bytes
Description ¶
string random_bytes ( int$length
)Generates an arbitrary length string of cryptographic random bytes that are suitable for cryptographic use, such as when generating salts, keys or initialization vectors.
The sources of randomness used for this function are as follows:
- On Windows, » CryptGenRandom() will always be used.
- On Linux, the » getrandom(2) syscall will be used if available.
- On other platforms, /dev/urandom will be used.
- If none of the aforementioned sources are available, then an Exception will be thrown.
Source: PHP: random_bytes – Manual
PHP: random_bytes – Manual was last modified: July 13th, 2017 by