diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index ef5100c359..19207ffb86 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -1206,7 +1206,7 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked() const int blockSize = qt_hash_block_size(method); messageHash.finalizeUnchecked(); - QByteArrayView hashedMessage = messageHash.resultView(); + const HashResult hashedMessage = messageHash.result; QVarLengthArray oKeyPad(blockSize); const char * const keyData = key.constData(); @@ -1214,10 +1214,10 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked() for (int i = 0; i < blockSize; ++i) oKeyPad[i] = keyData[i] ^ 0x5c; - QCryptographicHashPrivate hash(method); - hash.addData(oKeyPad); - hash.addData(hashedMessage); - hash.finalizeUnchecked(); + messageHash.reset(); + messageHash.addData(oKeyPad); + messageHash.addData(hashedMessage.toByteArrayView()); + messageHash.finalizeUnchecked(); result = hash.resultView().toByteArray(); }