aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppSasl.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2023-01-31 19:55:13 +0100
committerLinus Jahn <lnj@kaidan.im>2023-01-31 19:55:42 +0100
commit1a79303169e245891a911174b6f1fa87fd177597 (patch)
treefe9d1ce5bae58d8a51255370257b3c0c3f699e73 /src/base/QXmppSasl.cpp
parenta97ae4c0fa96666326c29e7bacad92c8082598ae (diff)
downloadqxmpp-1a79303169e245891a911174b6f1fa87fd177597.tar.gz
Remove Qt < 5.15 compat code
Diffstat (limited to 'src/base/QXmppSasl.cpp')
-rw-r--r--src/base/QXmppSasl.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/base/QXmppSasl.cpp b/src/base/QXmppSasl.cpp
index d8a86bb0..d566dc5c 100644
--- a/src/base/QXmppSasl.cpp
+++ b/src/base/QXmppSasl.cpp
@@ -27,26 +27,6 @@ static const QMap<QString, QCryptographicHash::Algorithm> SCRAM_ALGORITHMS = {
{ QStringLiteral("SCRAM-SHA3-512"), QCryptographicHash::RealSha3_512 },
};
-// Returns the hash length in bytes (QCH::hashLength() only exists since 5.12).
-int hashLength(QCryptographicHash::Algorithm algorithm)
-{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
- return QCryptographicHash::hashLength(algorithm);
-#else
- switch (algorithm) {
- case QCryptographicHash::Sha1:
- return 160 / 8;
- case QCryptographicHash::Sha256:
- return 256 / 8;
- case QCryptographicHash::Sha512:
- case QCryptographicHash::RealSha3_512:
- return 512 / 8;
- default:
- return QCryptographicHash::hash({}, algorithm).size();
- }
-#endif
-}
-
// Calculate digest response for use with XMPP/SASL.
static QByteArray calculateDigest(const QByteArray &method, const QByteArray &digestUri, const QByteArray &secret, const QByteArray &nonce, const QByteArray &cnonce, const QByteArray &nc)
@@ -577,7 +557,7 @@ QXmppSaslClientScram::QXmppSaslClientScram(QCryptographicHash::Algorithm algorit
: QXmppSaslClient(parent),
m_algorithm(algorithm),
m_step(0),
- m_dklen(hashLength(algorithm))
+ m_dklen(QCryptographicHash::hashLength(algorithm))
{
const auto itr = std::find(SCRAM_ALGORITHMS.cbegin(), SCRAM_ALGORITHMS.cend(), algorithm);
Q_ASSERT(itr != SCRAM_ALGORITHMS.cend());