Skip to content

Conversation

@Goorzhel
Copy link

For reference, zxcvbn's signature.

Why not zxcvbn(max_length=ARBITRARILY_HIGH_NUMBER)?

I reasoned that max_length exists to prevent arbitrarily-long strings from sucking up too much CPU time.

>>> from zxcvbn import zxcvbn
>>> from timeit import timeit
>>> test = lambda i: zxcvbn(password="a"*i, max_length=i)
>>> timeit(lambda: test(100), number=1)
0.02540450499873259
>>> timeit(lambda: test(500), number=1)
2.764077340001677

(Of course, a string like "a"*500 will still score 1, but that's an edge case this PR shan't deal with.)

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 this pull request may close these issues.

1 participant