Skip to content
meshbrainPublic

About

A library to generate strong passwords and check password strength.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

Sifar can be used to check for strong passwords. Apart from the standard tests for length and homogeneity, it can check passwords that sound and spell similar to a given word.

Sifar can also generate passwords that satisfy the given criteria.

Version 0.2.0 is a complete rewrite. Please check usage before upgrading.

You need the text gem. This is installed automatically if Sifar is installed as a gem. More information on text can be found at github.com/threedaymonk/text.

Sifar has been tested only on *nix systems.

Install the gem:

> sudo gem install sifar

To use the Sifar gem with bundler, add the following line in your Gemfile:

gem 'sifar'

To add Sifar as a plugin in a Rails application, run the following command from your application root:

> ./script/plugin install git@github.com:meshbrain/sifar.git
require 'sifar'
checker = Sifar.new ...
p checker.errors unless checker.check(word)
require 'sifar'
checker = Sifar.new ...
password = checker.generate

Checks can be used separately or in combination.

Password should be at least x characters long.

checker = Sifar.new :minimum_length => 8
checker.check('pword')                        # => false
checker.check('password')                     # => true
checker.check('longpassword')                 # => true

Password should contain a mix of digits, uppercase and lowercase characters.

checker = Sifar.new :heterogeneous => true
checker.check('password')                     # => false
checker.check('Pa55w0rD')                     # => true

Password should not contain any word from a given file.

checker = Sifar.new :dictionary => '/path/to/dictionary'
checker.check('indictionary')                 # => false

Password should not contain any character from a given set.

checker = Sifar.new :character_blacklist => %w(& % $)
checker.check('pass%word')                    # => false

Levenshtein distance of two words should be more than a given threshold. :name is mandatory.

checker = Sifar.new :similarity => 1, :name => 'shoeman'
checker.check('showman')                      # => false
checker.check('anothershowman')               # => false
checker.check('password')                     # => true

Phonetic similarity of two words should be more than a given threshold. :name is mandatory.

checker = Sifar.new :phonetic_similarity => 1, :name => 'suman'
checker.check('showman')                      # => false
checker.check('password')                     # => true

NOTE: This check uses metaphone; and might not work as expected in all languages.

Copyright © 2011 Suman Debnath. See LICENSE for details.

About

A library to generate strong passwords and check password strength.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages