Continuing to move a few bits of unimportant code into the public I’ve released a ruby library called passmakr that assists in creating passwords in various useful formats.
Mostly it takes some key bits of code from another password library and re-uses it in a new way that has fewer dependencies etc.
It supports creating phonemic passwords – that humans should find easier to remember than random ones – as well as random ones using Ruby’s random function as well a mode for reading /dev/urandom.
Using it is trivial, the code has rdoc in it as well to show you the other modes.
require 'passmakr' require 'pp' pw = Passmakr.new(:phonemic, 8) pp pw.password
{:rot13=>"trrtrrFb", :crypt=>"qmRSIJG2fy7Yg", :string=>"geegeeSo", :nato=>"golf echo echo golf echo echo Sierra oscar", :md5=>"$1$NwZQhCce$sBvOWjLEVOjSyp89HORcv/"}
You can pass it modes of :phonemic, :random and :urandom.
There’s also a little cli tool included that works like this:
% passmakr -p -l 8 8 character phonemic password: Password: ooHivahn Crypt: gDxSAc/ewkTzg MD5: $1$TcwcAexC$nNxMbU5CTQTt4I.JSNRhx0 Rot 13: bbUvinua NATO: oscar oscar Hotel india victor alfa hotel november
The various modes printed are some often found in Unix systems, I’ll add other modes if people send me requests. Rot 13 is there just for laughs.
This code also extends the normal String class with a to_nato method that can be used on all strings:
"Foo Bar".to_nato => "Foxtrot oscar oscar Bravo alfa romeo"
The code and a gem to install it can be found at http://code.google.com/p/passmakr/