diff --git a/matching.coffee b/matching.coffee
index 2d104e7..b822754 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 |
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(): |