IndexError: list index out of range, on empty password
Tronic opened this issue · 1 comments
Tronic commented
>>> zxcvbn.zxcvbn('')
zxcvbn\__init__.py in zxcvbn(password, user_inputs)
26
27 matches = matching.omnimatch(password, ranked_dictionaries)
---> 28 result = scoring.most_guessable_match_sequence(password, matches)
29 result['calc_time'] = datetime.now() - start
30
zxcvbn\scoring.py in most_guessable_match_sequence(password, matches, _exclude_additive)
202 bruteforce_update(k)
203
--> 204 optimal_match_sequence = unwind(n)
205 optimal_l = len(optimal_match_sequence)
206
zxcvbn\scoring.py in unwind(n)
179 l = None
180 g = float('inf')
--> 181 for candidate_l, candidate_g in optimal['g'][k].items():
182 if candidate_g < g:
183 l = candidate_l
IndexError: list index out of range
As a workaround, password or ' '
works, but I gather that this should also not crash on an empty string.
abdullah-alnahas commented
Thank you for providing the Python implementation of zxcvbn.
I would like to report that it still raises an IndexError when an empty string is passed as input.