Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range, on empty password #64

Open
Tronic opened this issue Oct 29, 2021 · 1 comment · May be fixed by #65
Open

IndexError: list index out of range, on empty password #64

Tronic opened this issue Oct 29, 2021 · 1 comment · May be fixed by #65

Comments

@Tronic
Copy link

Tronic commented Oct 29, 2021

>>> 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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants