← 返回命令列表

Linux command

rand.1s 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate 32 random bytes

openssl rand -hex 32

Generate 32 random bytes

openssl rand -base64 32

Generate raw random bytes

openssl rand -out [random.bin] 256

Generate a random password

openssl rand -base64 18

Generate 1 kilobyte of random data

openssl rand -out [random.bin] 1K

说明

openssl rand generates cryptographically secure pseudo-random bytes using OpenSSL's CSPRNG (Cryptographically Secure Pseudo-Random Number Generator). The output provides 256 bits of security when properly seeded from the operating system's entropy source. The command is commonly used to generate random passwords, encryption keys, initialization vectors, and other security tokens. Without encoding options, raw binary bytes are output, which may not display properly in terminals. On modern operating systems, OpenSSL automatically seeds from trusted system entropy sources (/dev/urandom on Unix-like systems). The command fails if sufficient entropy is unavailable.

参数

-hex
Output random bytes as hexadecimal string (2 characters per byte)
-base64
Output random bytes encoded in base64
-out _file_
Write output to file instead of standard output
-rand _file_
Use specified file(s) as additional random seed source
-help
Display usage information

FAQ

What is the rand.1s command used for?

openssl rand generates cryptographically secure pseudo-random bytes using OpenSSL's CSPRNG (Cryptographically Secure Pseudo-Random Number Generator). The output provides 256 bits of security when properly seeded from the operating system's entropy source. The command is commonly used to generate random passwords, encryption keys, initialization vectors, and other security tokens. Without encoding options, raw binary bytes are output, which may not display properly in terminals. On modern operating systems, OpenSSL automatically seeds from trusted system entropy sources (/dev/urandom on Unix-like systems). The command fails if sufficient entropy is unavailable.

How do I run a basic rand.1s example?

Run `openssl rand -hex 32` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -hex do in rand.1s?

Output random bytes as hexadecimal string (2 characters per byte)