passphrase 0.1.0
passphrase
Trying to come up with a good passphrase when creating an SSH public key pair or when signing up for an online service is a pain. Typical password generators yield a string of random characters which may be strong but is often hard to type. The Diceware method constructs a passphrase made up of more-or-less recognizable words. This makes it easier to type, while still being reasonably secure. Passphrase is a command line tool written in Ruby for generating a passphrase using the Diceware method.
The act of rolling dice is simulated by requesting random numbers from www.random.org. If a network error occurs or a request fails, the program gracefully degenerates to using SecureRandom::random_number.
Words in the generated passphrase are selected from either the Diceware list or the alternate list edited by Alan Beale, referred to as the Beale list. The choice of list for each word is made randomly. Both lists are embedded into the code as compressed, base64 encoded strings. No external files are referenced.
Generating a passphrase
The command line interface is simple. You have the option to request from 3 to 10 words in the generated passphrase. The default is 5 if a number is not specified. In addition, at least one capital letter, one number character, and one non-alphanumeric character are automatically mixed into the passphrase. However, you can omit mixing if desired.
Usage: passphrase [options]
Options:
-n, --num-words NUMBER Desired number of words (3..10), default 5
-x, --[no-]mix Mix in cap, num, non-alphanum, default mix
-l, --local Force use of local random number generator
-h, --help Show this message and exit
-v, --version Show version and exit
Examples
$ passphrase --num-words 3
unmixed phrase => tomb sima smog
passphrase => ]omb s0ma smoG
$ passphrase --num-words 4 --no-mix
passphrase => humus smooth persia mz
If you don’t like a generated passphrase, repeat the command.
Contributing to passphrase
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright © 2011 Edmund Sumbar. See LICENSE.txt for further details.