nbutton23 / zxcvbn-go

zxcvbn password complexity algorithm in golang
MIT License
379 stars 49 forks source link

Filtering the matchers #24

Closed TheMacies closed 7 years ago

TheMacies commented 7 years ago

L33t matcher has some corner case issues that result in huge RAM and CPU usage. I removed the l33t matcher and suddenly our microservice became much more resource-friendly. However, instead of commenting the code I propose a way to filter out unwanted matchers . Goal of my change was to stay 100% backwards compatible so that updating vendor will not change how the library works at all . Here comes a chart of RAM usage of our microservice using this library . The huge change in resource usage happened right after I turned off l33t matcher.

memory_passwords

My code now looks like that : zxcvbn.PasswordStrength(password, inputs, matching.FilterL33tMatcher)

nbutton23 commented 7 years ago

The only other issue I found is the there is a compile error in the test on matching/matching_test.go:110 instead of matchesTemp := dicMatcher("first") it now needs to be matchesTemp := dicMatcher.MatchingFunc("first")

and TestDateSepMatch is broken. . . but thats my problem.