Stashbase

Generate

Command to generate UUID, random string, hash, passphrase, or SSH keypair

The generate command allows you to generate UUID, random string, hash, passphrase, or SSH keypair.

stashbase generate <COMMAND> [OPTIONS]

UUID

Use this command to generate a UUID v4 or v7.

stashbase generate uuid [OPTIONS]

v4

Use this command to generate a UUID v4.

stashbase generate uuid v4

v7

Use this command to generate a UUID v7.

stashbase generate uuid v7

Random (rand)

Use this command to generate a random string in a given encoding. There are 4 supported encodings:

  • Alphanumeric
  • Hexadecimal (hex)
  • Base32
  • Base64
  • Base64url
stashbase generate random <ENCODING> [OPTIONS]

Options

All of the random subcommands support those options. If you don't provide a length or bytes, it will default to 32. If you provide both, the bytes option will override the length option.

Prop

Type

Examples

# Generate alphanumeric string
stashbase generate random alphanumeric

# Generate hexadecimal string
stashbase generate random hex

# Generate hexadecimal string with 32 bytes
stashbase generate random hex --length 32

# Generate base32 string
stashbase generate random base32

# Generate base64 string
stashbase generate random base64

# Generate base64url string
stashbase generate random base64url

# Generate base64url uppercase string
stashbase generate random base64url --uppercase

Hash

Use this command to generate a hash for a value.

stashbase generate hash <VALUE> [OPTIONS]

Options

Prop

Type

Supported algorithms

  • sha224
  • sha256
  • sha384
  • sha512

Examples

# Generate SHA-256 hash (default)
stashbase generate hash "hello"

# Generate SHA-512 hash
stashbase generate hash "hello" --algorithm sha512

# Generate uppercase hash
stashbase generate hash "hello" --uppercase

Passphrase

Use this command to generate a passphrase.

stashbase generate passphrase [OPTIONS]

Options

Prop

Type

Examples

# Generate passphrase with defaults (6 words, "-" separator)
stashbase generate passphrase

# Generate passphrase with 4 words
stashbase generate passphrase --words 4

# Generate passphrase with custom separator
stashbase generate passphrase --separator "."

# Generate uppercase passphrase
stashbase generate passphrase --uppercase

SSH Keypair

Use this command to generate an SSH keypair.

stashbase generate ssh-keypair [OPTIONS]

Options

Prop

Type

Supported key types

  • ed25519
  • rsa

Examples

# Generate Ed25519 keypair with defaults
stashbase generate ssh-keypair

# Generate RSA keypair with custom size
stashbase generate ssh-keypair --type rsa --bits 8192

# Generate keypair with custom comment and output path
stashbase generate ssh-keypair --comment "dev@stashbase" --out "~/.ssh/id_dev_stashbase"

# Generate keypair and print public key
stashbase generate ssh-keypair --print-public

# Overwrite existing key files
stashbase generate ssh-keypair --force

On this page