OPENSSL-RAND(1ossl)
πΈ OPENSSL-RAND πΈ
okay so you found your way into the openssl-rand(1ossl) page, bestie, and honestly? iconic choice. this is the one that just hands you random bytes. like a little vending machine but for entropy. let's get into it π
β¨ SYNOPSIS β¨
openssl rand [-help] [-out file] [-base64] [-hex] [-engine id] [-rand
files] [-writerand file] [-provider name] [-provider-path path]
[-provparam [name:]key=value] [-propquery propq] num[K|M|G|T]
that's the whole vibe. tiny command, big responsibility. π«Ά
π DESCRIPTION π
so this command generates num random bytes using a cryptographically secure pseudo random number generator β a CSPRNG, say it with me β and yes the "cryptographically secure" part is doing a LOT of work there, we love her for it. π₯
you can tack a suffix [K|M|G|T] onto the num value to say "hey, scale this as a multiple of KiB/MiB/GiB/TiB respectively." but β and this is the part people get wrong β suffixes are case sensitive, and they mean binary multiples. so K = 1024 bytes, M = 1024*1024 bytes, etc. lowercase k is not it, bestie, it will not slay. π
the string 'max' can be substituted for a numerical value in num if you want the maximum number of bytes the CSPRNG can produce per instantiation. and currently? that's restricted to 2^61 bytes as per NIST SP 800-90C. so, like, a lot. but not infinite. π«
the random bytes come from the RAND_bytes(3) function, which gives you a security level of 256 bits β provided it managed to seed itself successfully from a trusted operating system entropy source. if it didn't? the command fails with a nonzero error code. no cap. for more details, see RAND_bytes(3), RAND(7), and EVP_RAND(7).
lowkey important: if the seeding fails, you do NOT get sketchy half-random bytes. you get an error. that's the whole point. don't ignore the exit code. π
π OPTIONS π
-helpβ prints out a usage message. the "girl help" of flags, but make it documentation. π-out fileβ writes tofileinstead of standard output. very demure, very file-based. π-base64β performs base64 encoding on the output. for when raw bytes are too feral for your terminal. β¨-hexβ shows the output as a hex string.deadbeefgirlies rise. π₯-engine idβ see "Engine Options" inopenssl(1). β οΈ heads up: this option is deprecated. it's giving 3.0-era nostalgia, not main character energy. π-rand files,-writerand fileβ see "Random State Options" inopenssl(1)for the details. go read that one, i'll wait. π¦-provider name-provider-path path-provparam [name:]key=value-propquery propqβ see "Provider Options" inopenssl(1),provider(7), andproperty(7). that's four options in one little group, we love efficiency. π
π SEE ALSO π
openssl(1), RAND_bytes(3), RAND(7), EVP_RAND(7)
like, go read them. they're the supporting cast and they understood the assignment. π
π¦ HISTORY π¦
the -engine option was deprecated in OpenSSL 3.0. she had her moment, and her moment has passed. π
π COPYRIGHT π
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (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>.
okay that's the whole page, you're officially educated β¨ this was OPENSSL-RAND(1ossl) from OpenSSL 3.5.0, dated 2026-09-25 β now go generate your bytes and stay seeded, bestie π
ππΈ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms