dropbox / zxcvbn-ios

A realistic password strength estimator.
https://tech.dropbox.com/2012/04/zxcvbn-realistic-password-strength-estimation/
MIT License
223 stars 64 forks source link

Added Singleton Object to load generated Data #8

Closed jessemx109 closed 9 years ago

jessemx109 commented 9 years ago

This adds the singleton object so memory doesn't grow to huge amounts. Look at what functions I moved into the new object so see if any are not needed in the standard DBMatcher Ojbect

leah commented 9 years ago

I think a singleton for the matcher is a great idea! However, I think maybe the whole object could be a singleton instead. Want to try to make it more comprehensive?

jessemx109 commented 9 years ago

I added a new object to the file to handle to resource allocations

jessemx109 commented 9 years ago

I was going to do that first but wasn't sure if it would cause problems in other calls having the same object be modified by multiple calls

leah commented 9 years ago

Hmm... you're right. Adding the (ever changing) user inputs to the matchers would mess things up. I'd still like to not duplicate the methods used to generate the data. Maybe just have the omnimatch method in DBMatcher and everything else in DBMatchResources?

jessemx109 commented 9 years ago

ya I wasn't sure what methods I could safely take out from the existing code

leah commented 9 years ago

@jessemx109 want to take a stab at it? Or I can make the change if you prefer.

Again, thanks for coming up with the idea.

jessemx109 commented 9 years ago

Ya I can take a look at it tonight

leah commented 9 years ago

:+1:

jessemx109 commented 9 years ago

Ok finally got time to remove those duplicate methods. I took out three methods that are only used once and left the two that are used in other places

leah commented 9 years ago

I made a few small changes to the formatting to look more like the original zxcvbn, mostly just made everything lowercase :stuck_out_tongue_closed_eyes:

leah commented 9 years ago

Thanks for your help! :tada: :trophy: