Closed disconnect3d closed 4 years ago
Uuu nice job @disconnect3d ! I'll sit on this during the upcoming weekend. Appreciate!
FWIW the has_whitespace
is bad, we should use re.compile
here too: https://pastebin.com/qJjr3S4n
Kudos to GwynbleidD and vesim for pointing this out.
It's good to review this PR by looking on it commit by commit.
List of changes:
re.findall
- the reality is,re
module does cache compiled regexes (see https://stackoverflow.com/questions/12514157/how-does-pythons-regex-pattern-caching-work), so it is not a big speedup, but at least it won't have to check if it is in cache.re.search(r"\s", string)
and just usech.isspace()
(for each character) instead.PASSWORD_COMPLEXITY
for each word - this seems to be a hot loop, so it's better to calculate this once.a<=len(x)<=b
check.return all([a, b])
creates an unnecessary lists and make a call (function calls are expensive in Python). Not that big deal, butreturn a and b
is just faster.password_search
as it seems it should be fine with generating things instead.