summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp')
-rw-r--r--src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp b/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp
index 90ea384319..21c55568ca 100644
--- a/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp
+++ b/src/corelib/doc/snippets/qmessageauthenticationcode/main.cpp
@@ -1,3 +1,4 @@
+// Copyright (C) 2023 The Qt Company Ltd.
// Copyright (C) 2016 Ruslan Nigmatullin <euroelessar@yandex.ru>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
@@ -13,13 +14,12 @@ int main(int argc, char *argv[])
//! [0]
//! [1]
- QMessageAuthenticationCode code(QCryptographicHash::Sha1);
- code.setKey(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]
}