Class: Zxcvbn::Tester
- Inherits:
-
Object
- Object
- Zxcvbn::Tester
- Defined in:
- lib/zxcvbn.rb
Instance Method Summary collapse
- #matching ⇒ Object
- #test(password, user_inputs = []) ⇒ Object
- #zxcvbn(password, user_inputs = []) ⇒ Object
Instance Method Details
#matching ⇒ Object
35 36 37 |
# File 'lib/zxcvbn.rb', line 35 def matching @matching ||= Matching.new end |
#test(password, user_inputs = []) ⇒ Object
39 40 41 |
# File 'lib/zxcvbn.rb', line 39 def test(password, user_inputs = []) Result.new(zxcvbn(password, user_inputs)) end |
#zxcvbn(password, user_inputs = []) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/zxcvbn.rb', line 43 def zxcvbn(password, user_inputs = []) start = (Time.now.to_f * 1000).to_i matches = matching.omnimatch(password, user_inputs) result = Scoring.most_guessable_match_sequence(password, matches) result["calc_time"] = (Time.now.to_f * 1000).to_i - start attack_times = TimeEstimates.estimate_attack_times(result["guesses"]) attack_times.each do |prop, val| result[prop] = val end result["feedback"] = Feedback.get_feedback(result["score"], result["sequence"]) result end |