diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index dd9a13ff355..fdbe5de41c1 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -502,6 +502,13 @@ void QMessageAuthenticationCode::addData(const QByteArray &data) addData(qToByteArrayViewIgnoringNull(data)); } +QByteArray QMessageAuthenticationCode::hash(const QByteArray &msg, const QByteArray &key, + QCryptographicHash::Algorithm method) +{ + return hash(qToByteArrayViewIgnoringNull(msg), + qToByteArrayViewIgnoringNull(key), method); +} + #include "qstring.h" qsizetype QString::toUcs4_helper(const ushort *uc, qsizetype length, uint *out) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index ac0ee44860e..8f616e966d1 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -1436,8 +1436,10 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked() noexcept /*! Returns the authentication code for the message \a message using the key \a key and the method \a method. + + \include qcryptographichash.cpp {qba-to-qbav-6.6} */ -QByteArray QMessageAuthenticationCode::hash(const QByteArray &message, const QByteArray &key, +QByteArray QMessageAuthenticationCode::hash(QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method) { QMessageAuthenticationCodePrivate mac(method); diff --git a/src/corelib/tools/qmessageauthenticationcode.h b/src/corelib/tools/qmessageauthenticationcode.h index 4fd811f74b8..9e7f9dfbdb0 100644 --- a/src/corelib/tools/qmessageauthenticationcode.h +++ b/src/corelib/tools/qmessageauthenticationcode.h @@ -48,8 +48,12 @@ public: QByteArrayView resultView() const noexcept; QByteArray result() const; +#if QT_CORE_REMOVED_SINCE(6, 6) static QByteArray hash(const QByteArray &message, const QByteArray &key, QCryptographicHash::Algorithm method); +#endif + static QByteArray hash(QByteArrayView message, QByteArrayView key, + QCryptographicHash::Algorithm method); private: Q_DISABLE_COPY(QMessageAuthenticationCode)