Menu

Home

John Dalbey
There is a newer version of this page. You can find it here.

This project is a random password and passphrase generator written in Python.

There are already a multitude of password generators in existence but I wanted to build one to meet my specific needs.
I was motivated after reading a Hacker News article about the topic.
In particular I studied the bitwords.py code (canonical.org) presented by Kragen in this article.

As I studied Kragen's code several questions occurred to me:

(I assume when he mentions "12-bit words" he is describing words chosen from a pool of 2^12 (4096) candidate words and his code creates this "pool" by slicing from the word list.)

  1. The word file he uses is ordered by word frequency and the most commonly occurring words tend to be short. So when he generates "6-bit" words, he is choosing from a pool of only 64 words taken from the beginning of the word list, which are very short words. I was curious why he did this, and concluded that he prefered short words because they are easier to remember or type.
  2. Similarly I noticed that his word list has 21822 words that are less than 6 letters long. So conceivably he could generate 14-bit words (2^14=16384) which would give you more entropy. But he didn't. So many of the words in the list are never used. Again, I assumed he limited the pool size to 4096 in attempt to improve word familiarity or memorability.
  3. After some contemplation, I concluded the algorithm would be slightly better if we choose a slice of size 16384 starting at some random place x in the list of 21822 (where x < 21822-16384)? I suppose we might generate some words that are slightly less common, but it seems to me that any 5-letter words is going to be pretty easy to remember.

So I decided to enhance his code to use the entire word list. In the process I converted it to OO style and add many explanatory comments.

You are welcome to assume I use this program to generate my own passwords but you'll never know for certain :)

Project Members:


MongoDB Logo MongoDB