2013
04.28

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.

The following two tabs change content below.

charlie root

VP of keeping it real / HNIC at pissedoffadmins.com
I bring the cold coffee.

Latest posts by charlie root (see all)

2 comments so far

Add Your Comment
  1. 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.