openssl

CLI

Generate random secrets, encode/decode base64, and hash files. Preinstalled on macOS and Linux.

Portable secrets, base64 and SHA-256 that behave the same on macOS and Linux

5 of 5 recipes verified by execution · 2026-09-17#secrets#random#base64#sha256#hash

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

Generate a random secret (base64, 32 bytes)

Verified macOS · Linux · 2026-09-17
openssl rand -base64 32

Generate a random hex token (64 chars)

Verified macOS · Linux · 2026-09-17
openssl rand -hex 32

Base64-encode a file on a single line (portable)

Verified macOS · Linux · 2026-09-17
openssl base64 -A -in file.txt
Common failures (1)
  • base64: invalid option -- wmacOS base64 has no -w0; use openssl base64 -A which works everywhere

Base64-decode a string (portable)

Verified macOS · Linux · 2026-09-17
echo 'aGVsbG8=' | openssl base64 -d -A

SHA-256 of a file (portable)

Verified macOS · Linux · 2026-09-17
openssl dgst -sha256 file.txt

Install

Homebrewbrew install openssl
aptsudo apt install openssl

Agent notes

When to use
Filling NEXTAUTH_SECRET-style env vars, encoding credentials, checking downloads
Quick examples
  • openssl rand -base64 32
  • openssl dgst -sha256 file.txt

Use from an agent

curl -s https://clihub.com/api/tools/openssl | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug openssl on the MCP server at https://clihub.com/mcp.

Homepage ↗Apache-2.00 views