24#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
29#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
43# ifndef QT_SHA3_KECCAK_COMPAT
44 Sha3_224 = RealSha3_224,
45 Sha3_256 = RealSha3_256,
46 Sha3_384 = RealSha3_384,
47 Sha3_512 = RealSha3_512,
49 Sha3_224 = Keccak_224,
50 Sha3_256 = Keccak_256,
51 Sha3_384 = Keccak_384,
52 Sha3_512 = Keccak_512,
68 explicit QCryptographicHash(Algorithm method);
69 QCryptographicHash(QCryptographicHash &&other)
noexcept : d(std::exchange(other.d,
nullptr)) {}
70 ~QCryptographicHash();
72 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCryptographicHash)
73 void swap(QCryptographicHash &other)
noexcept { qt_ptr_swap(d, other.d); }
75 void reset()
noexcept;
76 [[nodiscard]] Algorithm algorithm()
const noexcept;
78#if QT_DEPRECATED_SINCE(6
, 4
)
79 QT_DEPRECATED_VERSION_X_6_4(
"Use the QByteArrayView overload instead")
80 void addData(
const char *data, qsizetype length);
82#if QT_CORE_REMOVED_SINCE(6
, 3
)
83 void addData(
const QByteArray &data);
85 void addData(QByteArrayView data)
noexcept;
86 bool addData(QIODevice *device);
88 QByteArray result()
const;
89 QByteArrayView resultView()
const noexcept;
91#if QT_CORE_REMOVED_SINCE(6
, 3
)
92 static QByteArray hash(
const QByteArray &data, Algorithm method);
94 static QByteArray hash(QByteArrayView data, Algorithm method);
96 static QByteArrayView hashInto(QSpan<
char> buffer, QByteArrayView data, Algorithm method)
noexcept
97 {
return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
98 static QByteArrayView hashInto(QSpan<uchar> buffer, QByteArrayView data, Algorithm method)
noexcept
99 {
return hashInto(as_writable_bytes(buffer), {&data, 1}, method); }
100 static QByteArrayView hashInto(QSpan<std::byte> buffer, QByteArrayView data, Algorithm method)
noexcept
101 {
return hashInto(buffer, {&data, 1}, method); }
102 static QByteArrayView hashInto(QSpan<
char> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept
103 {
return hashInto(as_writable_bytes(buffer), data, method); }
104 static QByteArrayView hashInto(QSpan<uchar> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept
105 {
return hashInto(as_writable_bytes(buffer), data, method); }
106 static QByteArrayView hashInto(QSpan<std::byte> buffer, QSpan<
const QByteArrayView> data, Algorithm method)
noexcept;
108 static int hashLength(Algorithm method);
109 static bool supportsAlgorithm(Algorithm method);
111 Q_DISABLE_COPY(QCryptographicHash)
112 QCryptographicHashPrivate *d;