Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// Copyright (C) 2016 Ruslan Nigmatullin <euroelessar@yandex.ru>
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
4
5
#include <QtCore>
6
7
int
main
(
int
argc,
char
*argv[])
8
{
9
QCoreApplication
app
(argc, argv);
10
12
QByteArray
key
=
"key"
;
13
QByteArray
message
=
"The quick brown fox jumps over the lazy dog"
;
15
17
QMessageAuthenticationCode
code(
QCryptographicHash::Sha256
,
key
);
18
code.addData(
message
);
19
code.result().toHex();
// returns "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8"
21
23
QMessageAuthenticationCode::hash
(
message
,
key
,
QCryptographicHash::Sha256
).toHex();
25
}
QByteArray
\inmodule QtCore
Definition
qbytearray.h:57
QCoreApplication
\inmodule QtCore
Definition
qcoreapplication.h:48
QCryptographicHash::Sha256
@ Sha256
Definition
qcryptographichash.h:30
QMessageAuthenticationCode
\inmodule QtCore
Definition
qmessageauthenticationcode.h:17
QMessageAuthenticationCode::hash
static QByteArray hash(QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method)
Returns the authentication code for the message message using the key key and the method method.
Definition
qcryptographichash.cpp:1639
main
int main()
[0]
Definition
doc_src_objecttrees.cpp:5
key
GLuint64 key
Definition
qopengles2ext.h:2268
message
GLuint GLsizei const GLchar * message
Definition
qopengles2ext.h:154
app
QApplication app(argc, argv)
[0]
qtbase
src
corelib
doc
snippets
qmessageauthenticationcode
main.cpp
Generated by
1.10.0