OPENSSL-RAND(1SSL)
π OPENSSL-RAND π
ok bestie, welcome to openssl-rand from the OpenSSL crew β the lil glow-up corner of the openssl(1) fam whose entire job is generating pseudo-random bytes. yes. that's it. that's the gig. and it ATE. β¨
π SYNOPSIS π
openssl rand [-help] [-out file] [-base64] [-hex] [-rand files]
[-writerand file] [-provider name] [-provider-path path] [-provparam
[name:]key=value] [-propquery propq] num[K|M|G|T]
π¦ DESCRIPTION π¦
okay so basically this command generates num random bytes using a cryptographically secure pseudo random number generator (CSPRNG) β like, not the fake gamer random, the actual secure one, she's a queen fr fr. π
and here's the cute part: you can slap a suffix [K|M|G|T] on the end of your num value to say "hey bestie, scale this as a multiple of KiB/MiB/GiB/TiB respectively". but watch out β the suffixes are case sensitive, and they mean binary multiples, not the marketing ones. so:
K= 1024 bytesM= 1024*1024 bytes- etc π
You can also just say the string 'max' instead of a number in num, which requests the maximum number of bytes the CSPRNG can produce per instantiation. rn that's restricted to 2^61 bytes as per NIST SP 800-90C. that's a lot of bytes bestie, hydrate.
The random bytes come courtesy of the RAND_bytes(3) function, which brings a security level of 256 bits, provided it managed to seed itself successfully from a trusted operating system entropy source. and if it didn't? π it does not power through. the command fails with a nonzero error code. no vibes, no bytes. For more details, see RAND_bytes(3), RAND(7), and EVP_RAND(7).
β¨ OPTIONS β¨
-helpβ prints out a usage message. cute, informative, supportive. π«Ά-outfileβ writes tofileinstead of standard output.-base64β does base64 encoding on the output. aesthetic bytes. β¨-hexβ shows the output as a hex string. very hacker-coded, we love.-randfiles,-writerandfileβ see "Random State Options" inopenssl(1)for the details, bestie i'm not retyping all that.-providername-provider-pathpath-provparam[name:]key=value-propquerypropq
β see "Provider Options" in openssl(1), provider(7), and property(7). iykyk π§
π SEE ALSO π
openssl(1), RAND_bytes(3), RAND(7), EVP_RAND(7)
π HISTORY π
not me just finding out the -engine option was removed in OpenSSL 4.0. rip to a real one, fr fr. π
π 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 bye bestie, go generate some bytes responsibly π
muah, this was OPENSSL-RAND(1SSL) from OpenSSL version 4.0.3, dated 2026-09-29. stan. π
π¦ where this page comes from
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms