diff options
Diffstat (limited to 'src/corelib/tools/qcryptographichash.h')
-rw-r--r-- | src/corelib/tools/qcryptographichash.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h index 9bf473dd4b..8c4f70457f 100644 --- a/src/corelib/tools/qcryptographichash.h +++ b/src/corelib/tools/qcryptographichash.h @@ -8,6 +8,7 @@ #include <QtCore/qbytearray.h> #include <QtCore/qobjectdefs.h> +#include <QtCore/qspan.h> QT_BEGIN_NAMESPACE @@ -60,6 +61,7 @@ public: Blake2s_224, Blake2s_256, #endif + NumAlgorithms }; Q_ENUM(Algorithm) @@ -90,6 +92,19 @@ public: static QByteArray hash(const QByteArray &data, Algorithm method); #endif static QByteArray hash(QByteArrayView data, Algorithm method); + + static QByteArrayView hashInto(QSpan<char> buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); } + static QByteArrayView hashInto(QSpan<uchar> buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), {&data, 1}, method); } + static QByteArrayView hashInto(QSpan<std::byte> buffer, QByteArrayView data, Algorithm method) noexcept + { return hashInto(buffer, {&data, 1}, method); } + static QByteArrayView hashInto(QSpan<char> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), data, method); } + static QByteArrayView hashInto(QSpan<uchar> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept + { return hashInto(as_writable_bytes(buffer), data, method); } + static QByteArrayView hashInto(QSpan<std::byte> buffer, QSpan<const QByteArrayView> data, Algorithm method) noexcept; + static int hashLength(Algorithm method); static bool supportsAlgorithm(Algorithm method); private: |