mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 15:32:48 -07:00
Apply PBKDF2 when storing passwords
This commit is contained in:
parent
8a6cac8338
commit
05d6a29416
14 changed files with 208 additions and 70 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue