5#ifndef QMESSAGEAUTHENTICATIONCODE_H
6#define QMESSAGEAUTHENTICATIONCODE_H
8#include <QtCore/qcryptographichash.h>
20#if QT_CORE_REMOVED_SINCE(6
, 6
)
21 explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
22 const QByteArray &key);
24 explicit QMessageAuthenticationCode(QCryptographicHash::Algorithm method,
25 QByteArrayView key = {});
27 QMessageAuthenticationCode(QMessageAuthenticationCode &&other)
noexcept
28 : d{std::exchange(other.d,
nullptr)} {}
29 ~QMessageAuthenticationCode();
31 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMessageAuthenticationCode)
32 void swap(QMessageAuthenticationCode &other)
noexcept
33 { qt_ptr_swap(d, other.d); }
35 void reset()
noexcept;
37#if QT_CORE_REMOVED_SINCE(6
, 6
)
38 void setKey(
const QByteArray &key);
40 void setKey(QByteArrayView key)
noexcept;
42 void addData(
const char *data, qsizetype length);
43#if QT_CORE_REMOVED_SINCE(6
, 6
)
44 void addData(
const QByteArray &data);
46 void addData(QByteArrayView data)
noexcept;
47 bool addData(QIODevice *device);
49 QByteArrayView resultView()
const noexcept;
50 QByteArray result()
const;
52#if QT_CORE_REMOVED_SINCE(6
, 6
)
53 static QByteArray hash(
const QByteArray &message,
const QByteArray &key,
54 QCryptographicHash::Algorithm method);
56 static QByteArray hash(QByteArrayView message, QByteArrayView key,
57 QCryptographicHash::Algorithm method);
60 hashInto(QSpan<
char> buffer, QByteArrayView message, QByteArrayView key,
61 QCryptographicHash::Algorithm method)
noexcept
62 {
return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
64 hashInto(QSpan<uchar> buffer, QByteArrayView message, QByteArrayView key,
65 QCryptographicHash::Algorithm method)
noexcept
66 {
return hashInto(as_writable_bytes(buffer), {&message, 1}, key, method); }
68 hashInto(QSpan<std::byte> buffer, QByteArrayView message,
69 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
70 {
return hashInto(buffer, {&message, 1}, key, method); }
72 hashInto(QSpan<
char> buffer, QSpan<
const QByteArrayView> messageParts,
73 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
74 {
return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
76 hashInto(QSpan<uchar> buffer, QSpan<
const QByteArrayView> messageParts,
77 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept
78 {
return hashInto(as_writable_bytes(buffer), messageParts, key, method); }
80 hashInto(QSpan<std::byte> buffer, QSpan<
const QByteArrayView> message,
81 QByteArrayView key, QCryptographicHash::Algorithm method)
noexcept;
84 Q_DISABLE_COPY(QMessageAuthenticationCode)
85 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)
QSpan< uchar > finalizeUnchecked(QSpan< uchar > buffer) noexcept
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
static void sha3Finish(SHA3Context &ctx, QSpan< uchar > result, Sha3Variant sha3Variant)
blake2b_state blake2bContext
SHA384Context sha384Context
SHA224Context sha224Context
void addData(QCryptographicHash::Algorithm method, QByteArrayView data) noexcept
SHA512Context sha512Context
SHA256Context sha256Context
void finalizeUnchecked(QCryptographicHash::Algorithm method, QSpan< uchar > buffer) noexcept
void destroy(QCryptographicHash::Algorithm method)
blake2s_state blake2sContext
State(QCryptographicHash::Algorithm method)
void reset(QCryptographicHash::Algorithm method) noexcept