2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QMessageAuthenticationCode>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qmessageauthenticationcode.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qmessageauthenticationcode.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QMessageAuthenticationCode_new(int method, QMessageAuthenticationCode** outptr_QMessageAuthenticationCode) {
|
|
|
|
QMessageAuthenticationCode* ret = new QMessageAuthenticationCode(static_cast<QCryptographicHash::Algorithm>(method));
|
|
|
|
*outptr_QMessageAuthenticationCode = ret;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QMessageAuthenticationCode_new2(int method, struct miqt_string key, QMessageAuthenticationCode** outptr_QMessageAuthenticationCode) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QByteArray key_QByteArray(key.data, key.len);
|
2024-11-19 06:29:06 +00:00
|
|
|
QMessageAuthenticationCode* ret = new QMessageAuthenticationCode(static_cast<QCryptographicHash::Algorithm>(method), key_QByteArray);
|
|
|
|
*outptr_QMessageAuthenticationCode = ret;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QMessageAuthenticationCode_Reset(QMessageAuthenticationCode* self) {
|
|
|
|
self->reset();
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QMessageAuthenticationCode_SetKey(QMessageAuthenticationCode* self, struct miqt_string key) {
|
|
|
|
QByteArray key_QByteArray(key.data, key.len);
|
|
|
|
self->setKey(key_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QMessageAuthenticationCode_AddData(QMessageAuthenticationCode* self, const char* data, int length) {
|
2024-08-25 04:08:24 +00:00
|
|
|
self->addData(data, static_cast<int>(length));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QMessageAuthenticationCode_AddDataWithData(QMessageAuthenticationCode* self, struct miqt_string data) {
|
|
|
|
QByteArray data_QByteArray(data.data, data.len);
|
|
|
|
self->addData(data_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QMessageAuthenticationCode_AddDataWithDevice(QMessageAuthenticationCode* self, QIODevice* device) {
|
|
|
|
return self->addData(device);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QMessageAuthenticationCode_Result(const QMessageAuthenticationCode* self) {
|
|
|
|
QByteArray _qb = self->result();
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct miqt_string QMessageAuthenticationCode_Hash(struct miqt_string message, struct miqt_string key, int method) {
|
|
|
|
QByteArray message_QByteArray(message.data, message.len);
|
|
|
|
QByteArray key_QByteArray(key.data, key.len);
|
|
|
|
QByteArray _qb = QMessageAuthenticationCode::hash(message_QByteArray, key_QByteArray, static_cast<QCryptographicHash::Algorithm>(method));
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QMessageAuthenticationCode_Delete(QMessageAuthenticationCode* self, bool isSubclass) {
|
|
|
|
if (isSubclass) {
|
|
|
|
delete dynamic_cast<QMessageAuthenticationCode*>( self );
|
|
|
|
} else {
|
|
|
|
delete self;
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|