mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
@@ -435,8 +435,9 @@ void GeoIPManager::downloadFinished(const QString &url, QByteArray data)
|
||||
if (m_geoIPDatabase)
|
||||
delete m_geoIPDatabase;
|
||||
m_geoIPDatabase = geoIPDatabase;
|
||||
const QLocale locale {Preferences::instance()->getLocale()};
|
||||
Logger::instance()->addMessage(tr("GeoIP database loaded. Type: %1. Build time: %2.")
|
||||
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
|
||||
.arg(m_geoIPDatabase->type(), locale.toString(m_geoIPDatabase->buildEpoch())),
|
||||
Log::INFO);
|
||||
QString targetPath = Utils::Fs::expandPathAbs(
|
||||
specialFolderLocation(SpecialFolder::Data) + GEOIP_FOLDER);
|
||||
|
||||
@@ -78,16 +78,16 @@ QByteArray Utils::Password::PBKDF2::generate(const QByteArray &password)
|
||||
|
||||
std::array<unsigned char, 64> outBuf {};
|
||||
const int hmacResult = PKCS5_PBKDF2_HMAC(password.constData(), password.size()
|
||||
, reinterpret_cast<const unsigned char *>(salt.data()), (sizeof(salt[0]) * salt.size())
|
||||
, reinterpret_cast<const unsigned char *>(salt.data()), static_cast<int>(sizeof(salt[0]) * salt.size())
|
||||
, hashIterations, hashMethod
|
||||
, outBuf.size(), outBuf.data());
|
||||
, static_cast<int>(outBuf.size()), outBuf.data());
|
||||
if (hmacResult != 1)
|
||||
return {};
|
||||
|
||||
const QByteArray saltView = QByteArray::fromRawData(
|
||||
reinterpret_cast<const char *>(salt.data()), (sizeof(salt[0]) * salt.size()));
|
||||
reinterpret_cast<const char *>(salt.data()), static_cast<int>(sizeof(salt[0]) * salt.size()));
|
||||
const QByteArray outBufView = QByteArray::fromRawData(
|
||||
reinterpret_cast<const char *>(outBuf.data()), outBuf.size());
|
||||
reinterpret_cast<const char *>(outBuf.data()), static_cast<int>(outBuf.size()));
|
||||
|
||||
return (saltView.toBase64() + ':' + outBufView.toBase64());
|
||||
}
|
||||
@@ -110,11 +110,11 @@ bool Utils::Password::PBKDF2::verify(const QByteArray &secret, const QByteArray
|
||||
const int hmacResult = PKCS5_PBKDF2_HMAC(password.constData(), password.size()
|
||||
, reinterpret_cast<const unsigned char *>(salt.constData()), salt.size()
|
||||
, hashIterations, hashMethod
|
||||
, outBuf.size(), outBuf.data());
|
||||
, static_cast<int>(outBuf.size()), outBuf.data());
|
||||
if (hmacResult != 1)
|
||||
return false;
|
||||
|
||||
const QByteArray outBufView = QByteArray::fromRawData(
|
||||
reinterpret_cast<const char *>(outBuf.data()), outBuf.size());
|
||||
reinterpret_cast<const char *>(outBuf.data()), static_cast<int>(outBuf.size()));
|
||||
return slowEquals(key, outBufView);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user