hashapass

password generator
...when ‘fluffy’ is not enough
Home · About · FAQ · Contact
*NEW* Firefox bookmarklet · iPhone-formatted version · command line
Windows Vista Sidebar Gadget · Apple Dashboard Widget

Hashapass on the command line

Due to its adherence to standard cryptography algorithms, Hashapass passwords can easily be generated on most 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

The only prerequisite is openssl.

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:

#!/bin/bash
#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
echo -n "$PARAMETER" \
| openssl dgst -sha1 -binary -hmac "$PASSWORD" \
| openssl enc -base64 \
| cut -c 1-8

Variations could include scripts where the parameter is already known, or entered as a command-line argument, etc.