bsh // create syllabeled passwords

 function createPassword () {
    CNTSYLL=$1
    CNTNUM=$2
    test "x$1" == "x" && return 1
    test "x$2" == "x" && return 1
    PASS=""
    YYY=( a e i o u ei au ai eu iu ui oi)
    ZZZ=( b c d f g h j k l m n p q r s t v w x y z)
    for II in `seq 1 $CNTSYLL`; do
        RANDY=$[$RANDOM % ${#YYY[@]}];
        RANDZ=$[$RANDOM % ${#ZZZ[@]}];
        PASS="${PASS}${ZZZ[$RANDZ]}${YYY[$RANDY]}"
    done
    for II in `seq 1 $CNTNUM`; do
        PASS="${PASS}$(shuf -i 0-9 -n 1)"
    done
    echo "$PASS" | grep '[[:alnum:]]'
    return $?
 }
 createPassword 5 2
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s