lib/zxcvbn/matching.rb in zxcvbn-0.1.6 vs lib/zxcvbn/matching.rb in zxcvbn-0.1.7

- old
+ new

@@ -110,14 +110,10 @@ 6 # 1991 11 11 ] ] }.freeze - def self.empty(obj) - obj.empty? - end - def self.translate(string, chr_map) string.chars.map { |chr| chr_map[chr] || chr }.join end def self.sorted(matches) @@ -248,11 +244,11 @@ dup_l33t_index = i break end end if dup_l33t_index == -1 - sub_extension = sub.concat([[l33t_chr, first_key]]) + sub_extension = sub + [[l33t_chr, first_key]] next_subs << sub_extension else sub_alternative = sub.dup sub_alternative.delete_at(dup_l33t_index) sub_alternative << [l33t_chr, first_key] @@ -281,10 +277,10 @@ end def self.l33t_match(password, _ranked_dictionaries = RANKED_DICTIONARIES, _l33t_table = L33T_TABLE) matches = [] enumerate_l33t_subs(relevant_l33t_subtable(password, _l33t_table)).each do |sub| - break if empty(sub) # corner case: password has no relevant subs. + break if sub.empty? # corner case: password has no relevant subs. subbed_password = translate(password, sub) dictionary_match(subbed_password, _ranked_dictionaries).each do |match| token = password[match["i"]..match["j"]] if token.downcase == match["matched_word"]