diff --git a/init.coffee b/init.coffee
index cbf922b..01f0ca0 100644
a
|
b
|
zxcvbn = (password, user_inputs) -> |
48 | 48 | for i in [0...user_inputs.length] |
49 | 49 | # update ranked_user_inputs_dict. |
50 | 50 | # i+1 instead of i b/c rank starts at 1. |
51 | | ranked_user_inputs_dict[user_inputs[i].toLowerCase()] = i + 1 |
| 51 | ranked_user_inputs_dict[rot_13(user_inputs[i].toLowerCase())] = i + 1 |
52 | 52 | matches = omnimatch password |
53 | 53 | result = minimum_entropy_match_sequence password, matches |
54 | 54 | result.calc_time = time() - start |
diff --git a/matching.coffee b/matching.coffee
index 2d104e7..b961fb8 100644
a
|
b
|
|
1 | 1 | |
| 2 | rot_13 = (str) -> |
| 3 | str.replace /[a-zA-Z]/g, (c) -> |
| 4 | String.fromCharCode (if ((if c <= "Z" then 90 else 122)) >= (c = c.charCodeAt(0) + 13) then c else c - 26) |
| 5 | |
2 | 6 | empty = (obj) -> (k for k of obj).length == 0 |
3 | 7 | extend = (lst, lst2) -> lst.push.apply lst, lst2 |
4 | 8 | translate = (string, chr_map) -> (chr_map[chr] or chr for chr in string.split('')).join('') |
… |
… |
dictionary_match = (password, ranked_dict) -> |
22 | 26 | result = [] |
23 | 27 | len = password.length |
24 | 28 | password_lower = password.toLowerCase() |
| 29 | password_lower = rot_13(password_lower) |
25 | 30 | for i in [0...len] |
26 | 31 | for j in [i...len] |
27 | 32 | if password_lower[i..j] of ranked_dict |
… |
… |
dictionary_match = (password, ranked_dict) -> |
32 | 37 | i: i |
33 | 38 | j: j |
34 | 39 | token: password[i..j] |
35 | | matched_word: word |
| 40 | matched_word: rot_13(word) |
36 | 41 | rank: rank |
37 | 42 | ) |
38 | 43 | result |
diff --git a/scripts/build_frequency_lists.py b/scripts/build_frequency_lists.py
index 015f795..aa256eb 100644
a
|
b
|
def filter_ascii(lst): |
145 | 145 | return [word for word in lst if all(ord(c) < 128 for c in word)] |
146 | 146 | |
147 | 147 | def to_js(lst, lst_name): |
| 148 | lst = map(lambda x : codecs.encode(x, 'rot_13'), lst) |
148 | 149 | return 'var %s = %s;\n\n' % (lst_name, simplejson.dumps(lst)) |
149 | 150 | |
150 | 151 | def main(): |