0.0
Low commit activity in last 3 years
Ease password creation by allowing: * password generation * password weakness checking * hashing password to sha256, md5, sha, ntlm, lmhash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 13
~> 0
 Project Readme

easy-password

Password generator, checker, hasher

Examples

Adding a simple password generator and using it by default:

# Generate 10 random alphanumeric characters
EasyPassword.generator :random10 do
  SecureRandom.alphanumeric(10)
end

# Define the default generator
EasyPassword.default_generator = :random10

Adding a checker

# Implementing classic at least 1 lowercase, 1 upercase, 1 digit
EasyPassword.checker :aA1 do |password, all|
  list = { /\d/    => :digit_needed,
           /[A-Z]/ => :upercase_needed,
           /[a-z]/ => :lowercase_needed,
         }.lazy.map {|regex, failure| failure if password !~ regex }
               .reject(&:nil?)
  all ? list.to_a : list.first
end

# Looking for known bad passwords in a database (using Sequel)
Password.checker :hack_dictionary do |password, all|
  ! DB[:bad_passwords].first(:password => password).nil?
end

Creating password

password = EasyPassword.new
password = EasyPassword.new('foobar')

Checking for weakness

password.weakness