Apply PBKDF2 when storing passwords

This commit is contained in:
Chocobo1 2018-11-21 15:15:51 +08:00
parent 8a6cac8338
commit 05d6a29416
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
14 changed files with 208 additions and 70 deletions

View file

@ -31,7 +31,6 @@
#include <cmath>
#include <QByteArray>
#include <QCollator>
#include <QLocale>
#include <QRegExp>
@ -164,20 +163,6 @@ QString Utils::String::fromDouble(double n, int precision)
return QLocale::system().toString(std::floor(n * prec) / prec, 'f', precision);
}
// Implements constant-time comparison to protect against timing attacks
// Taken from https://crackstation.net/hashing-security.htm
bool Utils::String::slowEquals(const QByteArray &a, const QByteArray &b)
{
int lengthA = a.length();
int lengthB = b.length();
int diff = lengthA ^ lengthB;
for (int i = 0; (i < lengthA) && (i < lengthB); ++i)
diff |= a[i] ^ b[i];
return (diff == 0);
}
// This is marked as internal in QRegExp.cpp, but is exported. The alternative would be to
// copy the code from QRegExp::wc2rx().
QString qt_regexp_toCanonical(const QString &pattern, QRegExp::PatternSyntax patternSyntax);