Closed tjconcept closed 9 years ago
This looks like a drop in replacement for https://github.com/ericelliott/credential/pull/13. Should we close that one?
Yes, it is. It's basically just a rebasing of @brianmhunt's work.
And yes, it should automatically close issue and PR when merged.
Awesome. Thanks!
I'm OK to merge this once we have a statistics test.
@ericelliott heard anything from SO or other channels on this? I keep ending with the conclusion that hashes aren't vulnerable - but it's still just based on my gut.
Nothing new... I'm reaching the same conclusion, but I don't feel confident making the call to pull the constant time from the code. Now that we have a constant time test, I'm cool with merging this. I haven't run the tests myself on this branch. If both of you have run them, one of you should press the merge button. =) I have some errands to run, or I'd do it right now.
I stumbled upon https://github.com/freewil/scmp through one of your earlier posts in another auth-related module and think it seems neat.
Thanks @tjconcept -- scmp is the same idea as the comparison I wrote, but it it early-outs when one string lengths are inequal (which it should not).
@brianmhunt I see, but aren't hashes always same length?
If one consistently uses the same hashing function then yes. If one varies the hashing function, the the hash size may change.
It would be a matter of principle more than practicality. On considering it, one can still get the key size from the top-end (i.e. by varying up the length of the posit as opposed to varying down), so I am not sure there is any extra value here.
A "strong" constant-time function will do e.g. 5k comparisons for every comparison. Regardless of key size the comparison takes the same (long) length of time.
Assume that early bailout on shorter hash matters. =)
Yeah, I imagine some nefarious folks scanning a table for SHA-1 hashes (vs. SHA-256/etc).
OK... I pulled and tested this branch. Looks good to me.
I've merged the work of @brianmhunt with my recent changes.