thenables / pswd Goto Github PK
View Code? Open in Web Editor NEWHash and compare passwords with pbkdf2
License: MIT License
Hash and compare passwords with pbkdf2
License: MIT License
The password and hash comparison is vulnerable to a timing attack.
It would be best to replace it with a time-constant operation.
function compare(str1, str2) {
if (str1.length !== str2.length)
return false
var i = 0, result = 0
for (; i < str1.length; i++)
result |= str1[i].charCodeAt(0) ^ str2[i].charCodeAt(0)
return result === 0
}
Hi,
I'm the maintainer of Credential. We're currently trying to harden our constant time equality check in Credential, and we're looking for a good statistics test to ensure that our timing is constant enough to thwart timing attacks.
Your experience and feedback would be very useful. Please take a look at this proposed constant time string comparison. I'm especially interested in producing a test suite that can guarantee statistically significant constant time equality comparisons, and I believe such tests would be useful to your library, as well.
My assertion is that none of our libs are complete without a statistical proof that our constant time comparisons are constant enough to thwart actual timing attacks. See Crosby et al:
"We have shown that, even though the Internet induces significant timing jitter, we can reliably distinguish remote timing differences as low as 20 µs. A LAN environment has lower timing jitter, allowing us to reliably distinguish remote timing differences as small as 100 ns (possibly even smaller). These precise timing differences can be distinguished with only hundreds or possibly thousands of measurements." Crosby et al., "Opportunities and Limits of Remote Timing Attacks"
So if we're going to implement libraries and call them secure, we need to prove it in our test suites. Wouldn't you agree? With Credential, I don't just expect people to trust that it's secure. I'm putting my money where my mouth is.
Because what we do in our libraries potentially impacts the personal security of millions of people, I think it's our responsibility as security library maintainers to provide assurances that we take these things seriously.
Thanks for taking security seriously,
Eric Elliott
Author, "Programming JavaScript Applications"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.