Diceware: easy and secure passwords
How can we both have easy-to-remember passwords and have them be secure? The answer is that they have to be easy enough for humans to remember, yet hard to crack.
So we need one generator that will allow us to construct the “words” part of passwords, and a second, simpler one to generate a few random symbols or numbers.
Make a generator
Diceware
Diceware will be our first generator to provide the random words. Diceware’s default dictionaries are stronger than pure dictionary word-pickers.
The following command will create a password composed of 4 random words:
1 |
diceware -n 4 -d '' |
Result:
RiveterDigStoppablePrecook
Symbols and numbers
The numbers and symbols add a little bit of extra password strength, but their inclusion is specifically to satisfy legacy password complexity constraints that require digits and special characters.
An interesting thing is that their placement matters, because it is much more common for special symbols to be at the end of a password. Because of this, it is theoretically best to place the symbols in random places inside the password. But in turn this makes the password harder to remember.
There are many strategies that can generate random symbols. This is a quick and easy Linux way to do this:
1 2 3 4 5 6 7 |
tr -dc '!@#$%^&*()_+' < /dev/urandom \ | head -c 2 tr -dc '0-9' < /dev/urandom \ | head -c 2 echo |
Result:
+*26
Suggested generator
One suggestion for a generator script:
1 2 3 4 5 6 7 8 |
symbols="$(LC_ALL=C tr -dc '!@#$%^&*()_+' < /dev/urandom | head -c 2)" nums="$(LC_ALL=C tr -dc '0-9' < /dev/urandom | head -c 2)" p1="$(diceware -n 2 -d '')" p2="$(diceware -n 1 -d '')" p3="$(diceware -n 1 -d '')" echo "${p1}${symbols}${p2}${nums}${p3}" |
Result:
NativityRepossess#*Goldmine52Discuss
The static placement here is only for a simple example, if a user were to construct the password manually, they would pick a truly random placement for the extra symbols and numbers.
Note that the diceware command has a -s flag to insert special characters, but it replaces existing letters in the words with totally random symbols. While that can be more secure, it can also be harder to memorize which letter was replaced. Invoking separate instances allows inserting symbols between words while keeping all words intact.
Arguably this is not very easy to remember, but it is both more secure and easier to type than the notorious “Tr0ub4dor&3”.
But if you do not want to construct own password generator, just invoking Diceware with more words and extra symbols still does the trick:
1 |
diceware -n 5 -s 2 -d '' |
Result:
OnionSprainSingingEvergladeNe8t6y
Resources
See also:
- Diceware program: https://diceware.readthedocs.io/en/stable/readme.html#install
- Diceware word lists: https://diceware.readthedocs.io/en/stable/wordlists.html
- Polish Diceware dictionary: https://github.com/MaciekTalaska/diceware-pl/
- XKCD “Password Strength”: https://xkcd.com/936/
