Use a constant-time secure comparison for passwords#119
Use a constant-time secure comparison for passwords#119glittershark wants to merge 1 commit intobcrypt-ruby:masterfrom
Conversation
16f31c1 to
bbc1553
Compare
Use a constant-time byte-by-byte secure comparison to compare potential password hashes rather than `String#==`, which uses strcmp under the hood and stops as soon as there's an unmatched byte.
|
see #42, which I didn't notice until after I did this. |
|
Also, this is breaking on a build on ruby-head - don't know if that's my fault |
|
(Bumping for CI) |
|
It buys nothing except "we're following best practices," which is in itself valuable. |
|
another +1 |
|
👍 from me too |
|
It is described in #43 why it is not necessary in this case. Has anything changed since then? |
Bcrypt has preimage resistance according to known methods. Science is a process and remember There is really no practical argument here, not to include this. The negligible performance decrease is not worth the security decrease. |
|
I’m not sure why you saw fit to resurrect a decade-old issue and specifically tag me but here we go.
Leave me alone. |
|
Closing in favor of #282. @glittershark I cherry-picked your commit in to #282 then added some trivial performance related stuff (specifically just avoiding array allocations). |
Use a constant-time byte-by-byte secure comparison to compare potential
password hashes rather than
String#==, which uses strcmp under thehood and stops as soon as there's an unmatched byte.