From 8de0262ded003c98e57c76022f7249743c1180d5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 Feb 2023 13:34:22 +0100 Subject: [PATCH] QMessageAuthenticationCode: use SHA-256 instead of insecure SHA-1 in doc sippet Pick-to: 6.5 Change-Id: I5b39229abbb3e21d90fd83f5f3bcbe1afe609526 Reviewed-by: Thiago Macieira --- .../doc/snippets/qmessageauthenticationcode/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp b/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp index 530f93cdd56..21c55568cac 100644 --- a/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp +++ b/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp @@ -14,12 +14,12 @@ int main(int argc, char *argv[]) //! [0] //! [1] - QMessageAuthenticationCode code(QCryptographicHash::Sha1, key); + QMessageAuthenticationCode code(QCryptographicHash::Sha256, key); code.addData(message); - code.result().toHex(); // returns "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9" + code.result().toHex(); // returns "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8" //! [1] //! [2] - QMessageAuthenticationCode::hash(message, key, QCryptographicHash::Sha1).toHex(); + QMessageAuthenticationCode::hash(message, key, QCryptographicHash::Sha256).toHex(); //! [2] }