Deterministic password generator using a chained hash pipeline.
Find a file
2026-05-10 21:38:51 +00:00
about Aggiungi about 2026-03-18 18:25:20 +00:00
install Aggiorna install 2026-05-10 21:38:51 +00:00
keygen Aggiorna keygen 2026-03-19 20:04:01 +00:00
LICENSE Aggiungi LICENSE 2026-03-18 19:15:02 +00:00
README.md Aggiorna README.md 2026-03-18 18:42:45 +00:00
VERSION Aggiungi VERSION 2026-03-18 18:25:43 +00:00

keygen

Deterministic password generator using a chained hash pipeline.

Description

keygen is a minimal shell script that generates deterministic passwords and hashes from stdin input using a chained pipeline of standard Unix hash utilities:

md5sum → sha1sum → sha224sum → sha256sum → sha384sum → sha512sum → base64

Designed for use in automated encryption workflows where reproducible key derivation from a known secret is required — no external dependencies beyond standard coreutils.

Usage

printf 'secret' | keygen [OPTIONS]
echo 'secret'   | keygen [OPTIONS]
keygen [OPTIONS]          # prompts for input interactively

Options

Option Description
hash Output raw hash instead of base64-encoded password
-s Inject special characters (!@#%) every 5 characters
N Truncate output to N characters (default: 500)

Examples

# Generate a password from a secret (piped)
printf 'mysecret' | keygen

# Interactive input (prompts for text)
keygen

# Generate a shorter password (32 chars)
printf 'mysecret' | keygen 32

# Generate a password with special characters
printf 'mysecret' | keygen -s 32

# Output raw hash only
printf 'mysecret' | keygen hash

# Use as key derivation in a script
key=$(printf '%s\n' "$disk_id" | keygen 64)

Dependencies

  • md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum — coreutils
  • base64 — coreutils
  • awk, cut — standard Unix tools

Security Notes

  • Output is fully deterministic: same input always produces same output
  • No state, no files, no network — runs entirely in memory
  • Intended for use in pipelines where the input secret is already protected
  • Do not use with weak or short secrets