step crypto rand

Name

step crypto rand -- generate random strings

Usage

step crypto rand [<length>] [--format=<format>] [--dictionary=<file>]

Description

step rand generates random strings that can be used for multiple purposes. The rand command supports printing stings with different formats. It defaults to use the printable characters of the ASCII table; rand also supports generating a memorable password using words from a provided dictionary.

The length of the random string will default to 32 characters or 6 words separated by a dash (-) if a dictionary is used.

The list of supported formats is the following:

  • ascii: generates a random string using the 94 printable characters of the ASCII table.
  • alphanumeric: uses the 62 alphanumeric characters in the POSIX/C locale (a-z+A-Z+0-9).
  • alphabet: uses the 52 alphabetic characters in the POSIX/C locale (a-z+A-Z).
  • hex: uses the 16 hexadecimal characters in lowercase (0-9+a-f).
  • dec: uses the 10 decimal characters (0-9).
  • lower: uses the 26 lowercase alphabetic characters in the POSIX/C locale (a-z).
  • upper: uses the 26 uppercase alphabetic characters in the POSIX/C locale (A-Z).
  • emoji: uses a curated list of 256 emojis that are not entirely similar.
  • raw: uses random bytes.

The following special formats are also supported:

  • die: generates a random number between 1 and 6 (by default) or 1 and the provided argument.
  • prime: generates number of the given bit length that is prime with high probability.
  • uuid: generates a UUIDv4.

Positional arguments

length The length of the random string in characters or words. If the die format is used, the length is the maximum number of the die.

Options

--format=format The format of the output string. See help for list of available formats.

--dictionary=file, --dict=file The file to use as a dictionary to get random words.

Examples

Generate a random string using the default format (ascii) and length (32):

$ step crypto rand Ijghm(Y?pfZiTPkHv0Z=1@MC<n&gsMe|

Generate a random memorable string using a dictionary of words:

$ step crypto rand --dictionary words.txt scalpel-elan-fulsome-BELT-warring-balcony

Generates a random roll of a die:

$ step crypto rand --format die 4

Generates a random hexadecimal string of 16 characters:

$ step crypto rand --format hex 16 f86a3f7b9299a413
Generates 20 upper-case characters: $ step crypto rand --format upper 20 LMCKDYUMRVJTTTZIKWGG