Home of friendly passwords
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Friendly Password Build Status Dependency Status

Want to generate rememberable, yet secure passwords for your users?

gem 'friendly_password'

in your Gemfile or

gem install friendly_password

And start generating!

FriendlyPassword.generate #=> "%5andr08s"

The options for FriendlyPassword.generate are:

:length   => # generate password with a fixed length         (default nil)
:min      => # define a minimum length for the password      (default 8)
:max      => # define a maximum length for the password      (default 12)
:peppers  => # use your own custom peppers for the password  (default %W(_ ? & %))

Friendly password generates its passwords based on a list of 8000 names. It remembers the last used names so it does not generate similar passwords in a row. It does not generate unique passwords, but the maximum of equal passwords measured in a set of 10'000 is 3, or put in percentage: 0.0003%. If, for some reason you have to make absolutely sure you're generating unique passwords, use uuid generators instead of this tool.

If the name list is too small for you, you want to try other names or you're simply fed up with the ones you have, try this:

FriendlyPassword.names = %W(my own custom list of names)

Some characters that are easily misinterpreted are replaced by FriendlyPassword to generate your passwords. “l”, for instance, becomes “1”, and “s” becomes “5”. If you want to use your own custom mapping, pass a map to replace_map

FriendlyPassword.replace_map = {'t' => '+', 'z' => 7} # (default {'l' => '1', 'i' => '!', 'd' => '6', 'o' => '0', 'g' => '9', 'q' => '9', 's' => '5', 'z' => '7'})

You can also permanently replace the peppers used for password generation:

FriendlyPassword.peppers = %W(ç & /) (default %W(_ ? & %))

Contributing to Friendly Password

  • 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 © 2014 Beat Richartz. See LICENSE.txt for further details.