+++ categories = ['hax'] date = '2021-08-12' description = 'Generate deterministic passwords on the command line' slug = 'deterministic-passwords' title = 'Generate deterministic passwords on the command line' +++
This is a simple shell function that uses openssl to create a unique password for any website / service using a master password salt.
> pass twitter.com
Password:
_1vvfamnYcHegiXn0uAL2n1. is now in your clipboard for twitter.com.
>
Your twitter password is now in your clipboard ready to paste.
Add this function to your .bashrc or .zshrc file. On MacOS replace xclip
with pbcopy
.
pass() { _p=$(openssl passwd -1 -salt $(read -s '_pass?Password: ' && echo $_pass) "$1" | awk -F$ '{print "_1"$NF}') && echo "$_p is now in your clipboard for $1." && echo $_p | xclip -selection clipboard }
pass() { _p=$(openssl passwd -1 -salt $(read -s -p 'Password: ' _pass && echo $_pass) "$1" | awk -F$ '{print "_1"$NF}') && echo "$_p is now in your clipboard for $1." && echo $_p | xclip -selection clipboard }