Last active
August 29, 2015 14:13
-
-
Save nilskoppelmann/8bd0a5e90d1f0be21dc2 to your computer and use it in GitHub Desktop.
simple password generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: ./pwdgen.sh [keysize] | |
keyfile=file | |
ssh-keygen -t rsa -f $keyfile -b 1024 -N '' -v &> /dev/null | |
totallinenumbers=$(grep -c ".*" $keyfile) | |
linenumber=$(echo $(($RANDOM % $(expr $totallinenumbers - 2) + 2 | bc))) | |
echo $(sed -n $(echo $linenumber)p $keyfile) | fold -w $(echo $1)| cat -b | sort -rn | cut -f2- | tail -1 | |
rm $keyfile $keyfile.pub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment