password generator
Home · About · Contact · English 
Firefox/Chrome · iPhone · Android · command line
Mac OS X Widget · Windows gadget · mobile web

Hashapass on the command line

Hashapass passwords can easily be generated on almost any modern Unix-like system using the following command line pattern:

echo -n parameter \
| openssl dgst -sha1 -binary -hmac password \
| openssl enc -base64 \
| cut -c 1-8

This requires openssl as well as GNU coreutils.

Caution! Most systems will keep a history of recently-typed commands. You probably do not want to use the above template directly, but rather inside of a shell script that will prompt you for your master password.

Simon Elmir contributed just such a script:

#hashapass.com method for generating passwords
#script by Simon Elmir
export IFS="" #read will now preserve whitespace
read -rp "parameter: " PARAMETER
read -rsp "password: " PASSWORD
echo -n "$PARAMETER" \
| openssl dgst -sha1 -binary -hmac "$PASSWORD" \
| openssl enc -base64 \
| cut -c 1-8