mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-06 21:31:23 +01:00
Utilities: Add static_cast in Hmac()
This commit is contained in:
parent
267cd3660b
commit
350debb66c
@ -479,15 +479,15 @@ void OpenInFileBrowser(const QList<QUrl> &urls) {
|
|||||||
|
|
||||||
QByteArray Hmac(const QByteArray &key, const QByteArray &data, const QCryptographicHash::Algorithm method) {
|
QByteArray Hmac(const QByteArray &key, const QByteArray &data, const QCryptographicHash::Algorithm method) {
|
||||||
|
|
||||||
const int kBlockSize = 64; // bytes
|
constexpr int block_size = 64;
|
||||||
Q_ASSERT(key.length() <= kBlockSize);
|
Q_ASSERT(key.length() <= block_size);
|
||||||
|
|
||||||
QByteArray inner_padding(kBlockSize, static_cast<char>(0x36));
|
QByteArray inner_padding(block_size, static_cast<char>(0x36));
|
||||||
QByteArray outer_padding(kBlockSize, static_cast<char>(0x5c));
|
QByteArray outer_padding(block_size, static_cast<char>(0x5c));
|
||||||
|
|
||||||
for (int i = 0; i < key.length(); ++i) {
|
for (int i = 0; i < key.length(); ++i) {
|
||||||
inner_padding[i] = inner_padding[i] ^ key[i];
|
inner_padding[i] = static_cast<char>(inner_padding[i] ^ key[i]);
|
||||||
outer_padding[i] = outer_padding[i] ^ key[i];
|
outer_padding[i] = static_cast<char>(outer_padding[i] ^ key[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray part;
|
QByteArray part;
|
||||||
|
Loading…
Reference in New Issue
Block a user