2024-10-20 05:21:03 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QMessageAuthenticationCode>
|
|
|
|
#include <qmessageauthenticationcode.h>
|
|
|
|
#include "gen_qmessageauthenticationcode.h"
|
2024-12-11 06:55:47 +00:00
|
|
|
|
|
|
|
#ifndef _Bool
|
|
|
|
#define _Bool bool
|
|
|
|
#endif
|
2024-10-20 05:21:03 +00:00
|
|
|
#include "_cgo_export.h"
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QMessageAuthenticationCode* QMessageAuthenticationCode_new(int method) {
|
|
|
|
return new QMessageAuthenticationCode(static_cast<QCryptographicHash::Algorithm>(method));
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QMessageAuthenticationCode* QMessageAuthenticationCode_new2(int method, struct miqt_string key) {
|
2024-10-20 05:21:03 +00:00
|
|
|
QByteArray key_QByteArray(key.data, key.len);
|
2024-12-07 04:15:57 +00:00
|
|
|
return new QMessageAuthenticationCode(static_cast<QCryptographicHash::Algorithm>(method), key_QByteArray);
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMessageAuthenticationCode_Reset(QMessageAuthenticationCode* self) {
|
|
|
|
self->reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMessageAuthenticationCode_SetKey(QMessageAuthenticationCode* self, struct miqt_string key) {
|
|
|
|
QByteArray key_QByteArray(key.data, key.len);
|
|
|
|
self->setKey(key_QByteArray);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMessageAuthenticationCode_AddData(QMessageAuthenticationCode* self, const char* data, ptrdiff_t length) {
|
|
|
|
self->addData(data, (qsizetype)(length));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMessageAuthenticationCode_AddDataWithData(QMessageAuthenticationCode* self, struct miqt_string data) {
|
|
|
|
QByteArray data_QByteArray(data.data, data.len);
|
|
|
|
self->addData(data_QByteArray);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMessageAuthenticationCode_AddDataWithDevice(QMessageAuthenticationCode* self, QIODevice* device) {
|
|
|
|
return self->addData(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
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-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-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|