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
qcryptographichash.h
Go to the documentation of this file.
1// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
2// Copyright (C) 2016 The Qt Company Ltd.
3// Copyright (C) 2013 Richard J. Moore <rich@kde.org>.
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5
6#ifndef QCRYPTOGRAPHICHASH_H
7#define QCRYPTOGRAPHICHASH_H
8
9#include <QtCore/qbytearray.h>
10#include <QtCore/qobjectdefs.h>
11
13
14
16class QIODevice;
17
18class Q_CORE_EXPORT QCryptographicHash
19{
21public:
22 enum Algorithm {
23#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
26#endif
27 Sha1 = 2,
28#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
33
34 Keccak_224 = 7,
38 RealSha3_224 = 11,
42# ifndef QT_SHA3_KECCAK_COMPAT
43 Sha3_224 = RealSha3_224,
44 Sha3_256 = RealSha3_256,
45 Sha3_384 = RealSha3_384,
46 Sha3_512 = RealSha3_512,
47# else
48 Sha3_224 = Keccak_224,
49 Sha3_256 = Keccak_256,
50 Sha3_384 = Keccak_384,
51 Sha3_512 = Keccak_512,
52# endif
53
54 Blake2b_160 = 15,
62#endif
63 NumAlgorithms
64 };
65 Q_ENUM(Algorithm)
66
67 explicit QCryptographicHash(Algorithm method);
68 QCryptographicHash(QCryptographicHash &&other) noexcept : d(std::exchange(other.d, nullptr)) {}
70
71 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCryptographicHash)
73
74 void reset() noexcept;
75 [[nodiscard]] Algorithm algorithm() const noexcept;
76
77#if QT_DEPRECATED_SINCE(6, 4)
78 QT_DEPRECATED_VERSION_X_6_4("Use the QByteArrayView overload instead")
79 void addData(const char *data, qsizetype length);
80#endif
81#if QT_CORE_REMOVED_SINCE(6, 3)
82 void addData(const QByteArray &data);
83#endif
84 void addData(QByteArrayView data) noexcept;
85 bool addData(QIODevice *device);
86
87 QByteArray result() const;
88 QByteArrayView resultView() const noexcept;
89
90#if QT_CORE_REMOVED_SINCE(6, 3)
91 static QByteArray hash(const QByteArray &data, Algorithm method);
92#endif
93 static QByteArray hash(QByteArrayView data, Algorithm method);
94 static int hashLength(Algorithm method);
95 static bool supportsAlgorithm(Algorithm method);
96private:
97 Q_DISABLE_COPY(QCryptographicHash)
99};
100
102
103#endif
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
QCryptographicHash(QCryptographicHash &&other) noexcept
Move-constructs a new QCryptographicHash from other.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLboolean reset
GLuint64EXT * result
[6]
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
Definition qswap.h:29
#define QT_DEPRECATED_VERSION_X_6_4(text)
#define Q_ENUM(x)
#define Q_GADGET
ptrdiff_t qsizetype
Definition qtypes.h:165
QSharedPointer< T > other(t)
[5]
this swap(other)