passphrase 0.0.3
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 is secure but is 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 specify the number of words in the generated passphrase within the range of 3 to 10. The default is 5. One odd character is automatically mixed into one of the words comprising the passphrase. 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 odd character, default mix
-h, --help Show this message
-v, --version Show version
Examples
$ passphrase --num-words 3
unmixed phrase => shot elm mild
odd character => !
passphrase => shot e!m mild
$ 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.