4#ifndef QMESSAGEAUTHENTICATIONCODE_H
5#define QMESSAGEAUTHENTICATIONCODE_H
7#include <QtCore/qcryptographichash.h>
19#if QT_CORE_REMOVED_SINCE(6
, 6
)
20 explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
21 const QByteArray &key);
23 explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
24 QByteArrayView key = {});
26 QMessageAuthenticationCode(QMessageAuthenticationCode &&other)
noexcept
27 : d{std::exchange(other.d,
nullptr)} {}
28 ~QMessageAuthenticationCode();
30 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMessageAuthenticationCode)
31 void swap(QMessageAuthenticationCode &other)
noexcept
32 { qt_ptr_swap(d, other.d); }
34 void reset()
noexcept;
36#if QT_CORE_REMOVED_SINCE(6
, 6
)
37 void setKey(
const QByteArray &key);
39 void setKey(QByteArrayView key)
noexcept;
41 void addData(
const char *data, qsizetype length);
42#if QT_CORE_REMOVED_SINCE(6
, 6
)
43 void addData(
const QByteArray &data);
45 void addData(QByteArrayView data)
noexcept;
46 bool addData(QIODevice *device);
48 QByteArrayView resultView()
const noexcept;
49 QByteArray result()
const;
51#if QT_CORE_REMOVED_SINCE(6
, 6
)
52 static QByteArray hash(
const QByteArray &message,
const QByteArray &key,
53 QCryptographicHash::Algorithm method);
55 static QByteArray hash(QByteArrayView message, QByteArrayView key,
56 QCryptographicHash::Algorithm method);
59 hashInto(QSpan<
char> buffer, QByteArrayView message, QByteArrayView key,
60 QCryptographicHash::Algorithm method)
noexcept
61 {
return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
63 hashInto(QSpan<uchar> buffer, QByteArrayView message, QByteArrayView key,
64 QCryptographicHash::Algorithm method)
noexcept
65 {
return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
67 hashInto(QSpan<std::byte> buffer, QByteArrayView message,
68 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
69 {
return hashInto(buffer, {&message, 1}, key, method); }
71 hashInto(QSpan<
char> buffer, QSpan<
const QByteArrayView> messageParts,
72 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
73 {
return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
75 hashInto(QSpan<uchar> buffer, QSpan<
const QByteArrayView> messageParts,
76 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
77 {
return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
79 hashInto(QSpan<std::byte> buffer, QSpan<
const QByteArrayView> message,
80 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept;
83 Q_DISABLE_COPY(QMessageAuthenticationCode)
84 QMessageAuthenticationCodePrivate *d;
QBasicMutex finalizeMutex
void addData(QByteArrayView bytes) noexcept
~QCryptographicHashPrivate()
QCryptographicHashPrivate(QCryptographicHash::Algorithm method) noexcept
void finalizeUnchecked() noexcept
QByteArrayView resultView() const noexcept
static bool supportsAlgorithm(QCryptographicHash::Algorithm method)
bool addData(QIODevice *dev)
QMessageAuthenticationCodePrivate(QCryptographicHash::Algorithm m) noexcept
void initMessageHash() noexcept
void setKey(QByteArrayView k) noexcept
QCryptographicHashPrivate messageHash
void finalizeUnchecked() noexcept
Combined button and popup list for selecting options.
constexpr int maxHashBlockSize()
QT_WARNING_PUSH QT_WARNING_POP static QT_BEGIN_NAMESPACE constexpr int hashLengthInternal(QCryptographicHash::Algorithm method) noexcept
static constexpr int qt_hash_block_size(QCryptographicHash::Algorithm method)
static HashBlock xored(const HashBlock &block, quint8 val) noexcept
static constexpr int maxHashLength()
constexpr int minHashBlockSize()
constexpr int gcdHashBlockSize()
unsigned long long DataLength
unsigned char BitSequence
blake2b_state blake2bContext
SHA384Context sha384Context
SHA224Context sha224Context
void addData(QCryptographicHash::Algorithm method, QByteArrayView data) noexcept
SHA512Context sha512Context
void finalizeUnchecked(QCryptographicHash::Algorithm method, HashResult &result) noexcept
SHA256Context sha256Context
void destroy(QCryptographicHash::Algorithm method)
blake2s_state blake2sContext
static void sha3Finish(SHA3Context &ctx, HashResult &result, int bitCount, Sha3Variant sha3Variant)
State(QCryptographicHash::Algorithm method)
void reset(QCryptographicHash::Algorithm method) noexcept