Last active
October 7, 2015 10:34
-
-
Save danielcarr/6fd7f55d070248f91f60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# hashapass.com method for generating passwords | |
# based on the script by Simon Elmir at http://hashapass.com/en/cmd.html | |
export IFS="" #read will now preserve whitespace | |
read -rp "parameter: " PARAMETER | |
read -rsp "password: " PASSWORD | |
echo | |
read -n 2 -rp "how many characters: " LENGTH | |
echo | |
echo -n "$PARAMETER" \ | |
| openssl dgst -sha1 -binary -hmac "$PASSWORD" \ | |
| openssl enc -base64 \ | |
| cut -c 1-${LENGTH:-10} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment