40# ifndef QT_SHA3_KECCAK_COMPAT
41 Sha3_224 = RealSha3_224,
42 Sha3_256 = RealSha3_256,
43 Sha3_384 = RealSha3_384,
44 Sha3_512 = RealSha3_512,
46 Sha3_224 = Keccak_224,
47 Sha3_256 = Keccak_256,
48 Sha3_384 = Keccak_384,
49 Sha3_512 = Keccak_512,
64 explicit QCryptographicHash(Algorithm method);
65 QCryptographicHash(QCryptographicHash &&other)
noexcept : d(std::exchange(other.d,
nullptr)) {}
66 ~QCryptographicHash();
68 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCryptographicHash)
69 void swap(QCryptographicHash &other)
noexcept { qt_ptr_swap(d, other.d); }
71 void reset()
noexcept;
72 [[nodiscard]] Algorithm algorithm()
const noexcept;
74#if QT_DEPRECATED_SINCE(6
, 4
)
75 QT_DEPRECATED_VERSION_X_6_4(
"Use the QByteArrayView overload instead")
76 void addData(
const char *data, qsizetype length);
78#if QT_CORE_REMOVED_SINCE(6
, 3
)
79 void addData(
const QByteArray &data);
81 void addData(QByteArrayView data)
noexcept;
82 bool addData(QIODevice *device);
84 QByteArray result()
const;
85 QByteArrayView resultView()
const noexcept;
87#if QT_CORE_REMOVED_SINCE(6
, 3
)
88 static QByteArray hash(
const QByteArray &data, Algorithm method);
90 static QByteArray hash(QByteArrayView data, Algorithm method);
92 static QByteArrayView hashInto(QSpan<
char> buffer, QByteArrayView data, Algorithm method)
noexcept
93 {
return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
94 static QByteArrayView hashInto(QSpan<uchar> buffer, QByteArrayView data, Algorithm method)
noexcept
95 {
return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
96 static QByteArrayView hashInto(QSpan<std::byte> buffer, QByteArrayView data, Algorithm method)
noexcept
97 {
return hashInto(buffer, {&data, 1}, method); }
98 static QByteArrayView hashInto(QSpan<
char> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept
99 {
return hashInto(as_writable_bytes(buffer), data, method); }
100 static QByteArrayView hashInto(QSpan<uchar> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept
101 {
return hashInto(as_writable_bytes(buffer), data, method); }
102 static QByteArrayView hashInto(QSpan<std::byte> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept;
104 static int hashLength(Algorithm method);
105 static bool supportsAlgorithm(Algorithm method);
107 Q_DISABLE_COPY(QCryptographicHash)
108 QCryptographicHashPrivate *d;