zshrc and password generator
so i added two different password generator functions into my .zshrc.
one for regular:
function genpasswd() {
if [ -z $1 ]; then
echo "need a character count"
else
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${1} | xargs
fi
}
and one for strong:
function genpasswd_strong() {
if [ -z $1 ]; then
echo "need a character count"
else
tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' < /dev/urandom | head -c ${1} | xargs
fi
}
using them:
% genpasswd 12
Z14QsnEPKvOt
% genpasswd_strong 12
3%^d!Ze}-$_@
simple enough.
here is a link to my .zshrc.
Does `pwgen 10 -N5` work?
not pre-installed in some of the distro’s i use. method i use does not need external addons or deps.