RAND(1) | OpenSSL | RAND(1) |
openssl-rand, rand - generate pseudo-random bytes
openssl rand [-help] [-out file] [-rand file...] [-writerand file] [-base64] [-hex] num
This command generates num random bytes using a cryptographically secure pseudo random number generator (CSPRNG).
The random bytes are generated using the RAND_bytes(3) function, which provides a security level of 256 bits, provided it managed to seed itself successfully from a trusted operating system entropy source. Otherwise, the command will fail with a nonzero error code. For more details, see RAND_bytes(3), RAND(7), and RAND_DRBG(7).
Prior to OpenSSL 1.1.1, it was common for applications to store information about the state of the random-number generator in a file that was loaded at startup and rewritten upon exit. On modern operating systems, this is generally no longer necessary as OpenSSL will seed itself from a trusted entropy source provided by the operating system. The -rand and -writerand flags are still supported for special platforms or circumstances that might require them.
It is generally an error to use the same seed file more than once and every use of -rand should be paired with -writerand.
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
2023-09-11 | 1.1.1w |