From 350debb66cf99179913bcddf0218fdd051d1d148 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 9 Nov 2021 19:32:00 +0100 Subject: [PATCH] Utilities: Add static_cast in Hmac() --- src/core/utilities.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 8baf49ceb..632c167d4 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -479,15 +479,15 @@ void OpenInFileBrowser(const QList &urls) { QByteArray Hmac(const QByteArray &key, const QByteArray &data, const QCryptographicHash::Algorithm method) { - const int kBlockSize = 64; // bytes - Q_ASSERT(key.length() <= kBlockSize); + constexpr int block_size = 64; + Q_ASSERT(key.length() <= block_size); - QByteArray inner_padding(kBlockSize, static_cast(0x36)); - QByteArray outer_padding(kBlockSize, static_cast(0x5c)); + QByteArray inner_padding(block_size, static_cast(0x36)); + QByteArray outer_padding(block_size, static_cast(0x5c)); for (int i = 0; i < key.length(); ++i) { - inner_padding[i] = inner_padding[i] ^ key[i]; - outer_padding[i] = outer_padding[i] ^ key[i]; + inner_padding[i] = static_cast(inner_padding[i] ^ key[i]); + outer_padding[i] = static_cast(outer_padding[i] ^ key[i]); } QByteArray part;