From e9fffbaf81ec81685cb6a5d75844cd700183ab9e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 6 Jul 2021 08:12:00 +0200 Subject: Use QCryptographicHash::hash() more widely ... instead of the "usual" rule of three: ctor, addData(), result(). Not only does it generate less code in the caller, it's now also faster. Change-Id: I67c7eeb01f527b90e80a08f60c1c7f2ec1e49dd4 Reviewed-by: Lars Knoll --- src/corelib/tools/qmessageauthenticationcode.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qmessageauthenticationcode.cpp b/src/corelib/tools/qmessageauthenticationcode.cpp index 2d0145147a..9580b024c2 100644 --- a/src/corelib/tools/qmessageauthenticationcode.cpp +++ b/src/corelib/tools/qmessageauthenticationcode.cpp @@ -122,10 +122,7 @@ void QMessageAuthenticationCodePrivate::initMessageHash() const int blockSize = qt_hash_block_size(method); if (key.size() > blockSize) { - QCryptographicHash hash(method); - hash.addData(key); - key = hash.result(); - hash.reset(); + key = QCryptographicHash::hash(key, method); } if (key.size() < blockSize) { -- cgit v1.2.3