Home brew passgen with rand and bash

I made this up this morning and I think it doesn’t suck. I put it in my .bash_aliases file, which is read by my .bashrc and then I have them on the command line:

mkpass_string() {
BOFS=${1:-Get}
EOFS=${2:-Clue}
SEPS=$(rand –mask ‘,.-=*_+^@’ -N 2 -d ” )
rand -M 99 -N 2 –bof “${BOFS}” -d “${SEPS}” –eof “${EOFS}”
}

mkpass() {
echo $(mkpass_string ${1} ${2})
}

Then I use them like this:

$ mkpass Milk rain
Milk35^+64rain

$ mkpass X Y
X21,,66Y

$ mkpass X Y
X70_-95Y

$ PASS=$(mkpass_string Blue Screw)
$ echo $PASS
Blue45*-74Screw

Just thought y’all might like it.

Leave a Reply

You must be logged in to post a comment.