Class: Zxcvbn::PasswordStrength
- Inherits:
-
Object
- Object
- Zxcvbn::PasswordStrength
- Defined in:
- lib/zxcvbn/password_strength.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ PasswordStrength
constructor
A new instance of PasswordStrength.
- #test(password, user_inputs = []) ⇒ Object
Constructor Details
#initialize(data) ⇒ PasswordStrength
Returns a new instance of PasswordStrength.
10 11 12 13 |
# File 'lib/zxcvbn/password_strength.rb', line 10 def initialize(data) @omnimatch = Omnimatch.new(data) @scorer = Scorer.new(data) end |
Instance Method Details
#test(password, user_inputs = []) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zxcvbn/password_strength.rb', line 15 def test(password, user_inputs = []) password ||= '' result = nil calc_time = Clock.realtime do matches = @omnimatch.matches(password, user_inputs) result = @scorer.minimum_entropy_match_sequence(password, matches) end result.calc_time = calc_time result.feedback = FeedbackGiver.get_feedback(result.score, result.match_sequence) result end |