1RAND(1) OpenSSL RAND(1)
2
3
4
6 openssl-rand, rand - generate pseudo-random bytes
7
9 openssl rand [-help] [-out file] [-rand file...] [-writerand file]
10 [-base64] [-hex] num
11
13 This command generates num random bytes using a cryptographically
14 secure pseudo random number generator (CSPRNG).
15
16 The random bytes are generated using the RAND_bytes(3) function, which
17 provides a security level of 256 bits, provided it managed to seed
18 itself successfully from a trusted operating system entropy source.
19 Otherwise, the command will fail with a nonzero error code. For more
20 details, see RAND_bytes(3), RAND(7), and RAND_DRBG(7).
21
23 -help
24 Print out a usage message.
25
26 -out file
27 Write to file instead of standard output.
28
29 -rand file...
30 A file or files containing random data used to seed the random
31 number generator. Multiple files can be specified separated by an
32 OS-dependent character. The separator is ; for MS-Windows, , for
33 OpenVMS, and : for all others. Explicitly specifying a seed file
34 is in general not necessary, see the "NOTES" section for more
35 information.
36
37 [-writerand file]
38 Writes random data to the specified file upon exit. This can be
39 used with a subsequent -rand flag.
40
41 -base64
42 Perform base64 encoding on the output.
43
44 -hex
45 Show the output as a hex string.
46
48 Prior to OpenSSL 1.1.1, it was common for applications to store
49 information about the state of the random-number generator in a file
50 that was loaded at startup and rewritten upon exit. On modern operating
51 systems, this is generally no longer necessary as OpenSSL will seed
52 itself from a trusted entropy source provided by the operating system.
53 The -rand and -writerand flags are still supported for special
54 platforms or circumstances that might require them.
55
56 It is generally an error to use the same seed file more than once and
57 every use of -rand should be paired with -writerand.
58
60 RAND_bytes(3), RAND(7), RAND_DRBG(7)
61
63 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
64
65 Licensed under the OpenSSL license (the "License"). You may not use
66 this file except in compliance with the License. You can obtain a copy
67 in the file LICENSE in the source distribution or at
68 <https://www.openssl.org/source/license.html>.
69
70
71
721.1.1l 2021-09-15 RAND(1)