Generate word-based passwords, inspired by XKCD/936.

Includes consideration for smart-phone keyboards, using space, period and comma as punctuation.

Unix based systems only, requires /usr/share/dict/words

Pat Beirne c61128f54c changed bit ifelse() chain to a match/case 6 hónapja
pwgen 6abbabddc1 added a first README 7 hónapja
README.md 2bbe080275 complete overhaul, version 1.3 6 hónapja
pwgen.py c61128f54c changed bit ifelse() chain to a match/case 6 hónapja

README.md

pwgen

Generate word-based passwords. Based on XKCD/936, word-based passwords are easier to remember than a string of random letters/numbers/punctuation.

[TOC]

Overview

Password generators can be found all over the internet, but most generate random combinations of letters + numbers + punctuation. If a combination of those is long enough to be secure, it is also long enough to be difficult to remember, and possible difficult to type.

The XKCD comic #936 introduced the idea that a phrase of 3, 4 or 5 common words can be used as a password that is sufficiently difficult to crack in our lifetimes. The program **pwgen** is a locally hosted generator of these kinds of pass phrases.

This program runs locally on a UNIX/Linux based computer, and the passphrase never crosses the network, so you can be sure that you're the only one who has ever seen it.

Usage

Simply invoke the program, and the defaults will give you a usable password phrase:

pwgen

returns

boards.coziest.allure

as a potential pass phrase. The following options exist:

-p    pad the words with spaces
-P    pad the words with spaces, periods or commas
-n    pad with numbers
-N    pad with numbers and punctuation (other than space)
-L <n>  minimum phrase length (default=20) (or --length <n>)
-c    make 2 word phrases with conjunction between them
<n>   make multiple phrases (default=1)

By default, pwgen will build a pass phrase using words from the dictionary at /usr/share/dict/words and add punctuation to separate the words.

$ pwgen
consequently?restraining

Adding the -p option will insist that the passphrase be padded with only spaces, making it easier to type on a smartphone. Similarly, the -P option uses only spaces, periods and commas, which are often easily accessed on a smartphone.

$ pwgen -p
garments mazes queasy
$ pwgen -P
crufted..teeth...buy

Some servers require numbers to be embedded in the password, so the -n and -N options are available.

$ pwgen -N
bleeding5clusters5berries#

The -L option allows you to specify a minimum length for the pass phrase, although the result may be a few characters longer than you requested, so that the words aren't chopped up.

$ pwgen -L 30
dittoed___nonabrasive___atomic

The -c option uses common English conjunctions to separate a pair of words. If the 2nd word starts with a vowel, the conjuntion "a" is changed to "an". I find these phrases much easier to remember than just a sequence of words.

$ pwgen -c
quick in a crowd

Part of the reason for using pass phrases is to make them easier to remember for us humans. Sometimes, the first phrases offered just doesn't seem memorable, so you can add a small integer after pwgen to get multiple offerings, and you can just choose the one that seems memorable to you.

$ pwgen 6
mechanisms..contempt
windbreak\\knuckling
pith$seconding$unkempt
adore/anthems/welder
firesides!!!spaceman
wannest=tabloids=weighty

Coming soon: Instead of spaces & punctuation, you will be able to use CamelCase to indicate word boundaries. Snake_case is also a commonly requested format. L3tt3rSubst!tut!0n will also be implemented.

Other implementations

http://www.egansoft.com/password/index.php

https://passwords-generator.org/words

https://passwordcreator.org/commonwords.html

https://mdigi.tools/memorable-password/

https://www.mapletech.co.uk/tools/password-generator/