Last active
December 4, 2015 17:37
-
-
Save jasontbradshaw/62958c491207de0ad9de to your computer and use it in GitHub Desktop.
Generate a Diceware-style password list.
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
#!/usr/bin/env bash | |
# This script takes a list of words and turns it into a 10-sided-die version of a | |
# Diceware list. It: | |
# * Reads a list of words | |
# * Removes long words and those with non-ASCII characters, for ease-of-use | |
# * Randomly orders them | |
# * Takes the first 10,000 (for use with 10-sided dice) | |
# * Sorts them nicely | |
# * Numbers the lines appropriately | |
# * Saves them to a new file | |
WORDS='/usr/share/dict/usa' | |
OUT='passwords.txt' | |
cat "${WORDS}" | \ | |
grep -P '^[a-zA-Z0-9]+$' | \ | |
sort -R | \ | |
head -n 10000 | \ | |
sort | \ | |
nl --number-format=rz --starting-line-number=0 --number-width=4 --number-separator=' ' | \ | |
> "${OUT}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment