Last active
February 22, 2017 16:06
-
-
Save timkuijsten/5271873 to your computer and use it in GitHub Desktop.
Generate strong and easy to type passwords. Tested with OpenBSD 5.2, Ubuntu 10.04, Ubuntu 12.04 and Mac OS X 10.8.
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 | |
# copy to /usr/local/bin | |
# usage: genpass [length] | |
LENGTH=12 | |
if [ 0 -lt $(($1)) ]; then | |
LENGTH=$1 | |
fi | |
# extract enough bytes from the random number generator | |
dd bs=$((80*$LENGTH)) count=1 if=/dev/random 2>/dev/null | LC_CTYPE=C tr -cd 'ABCDEFGHJKLMNPQRSTUVWXYZ' | cut -b 1-$LENGTH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment