2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QCryptographicHash>
|
|
|
|
#include <QIODevice>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qcryptographichash.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qcryptographichash.h"
|
2024-12-11 06:55:47 +00:00
|
|
|
|
|
|
|
#ifndef _Bool
|
|
|
|
#define _Bool bool
|
|
|
|
#endif
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QCryptographicHash* QCryptographicHash_new(int method) {
|
|
|
|
return new QCryptographicHash(static_cast<QCryptographicHash::Algorithm>(method));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QCryptographicHash_Reset(QCryptographicHash* self) {
|
|
|
|
self->reset();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCryptographicHash_AddData(QCryptographicHash* 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 QCryptographicHash_AddDataWithData(QCryptographicHash* 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 QCryptographicHash_AddDataWithDevice(QCryptographicHash* self, QIODevice* device) {
|
|
|
|
return self->addData(device);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QCryptographicHash_Result(const QCryptographicHash* 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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QCryptographicHash_Hash(struct miqt_string data, int method) {
|
|
|
|
QByteArray data_QByteArray(data.data, data.len);
|
|
|
|
QByteArray _qb = QCryptographicHash::hash(data_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-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QCryptographicHash_HashLength(int method) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return QCryptographicHash::hashLength(static_cast<QCryptographicHash::Algorithm>(method));
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QCryptographicHash_Delete(QCryptographicHash* self, bool isSubclass) {
|
|
|
|
if (isSubclass) {
|
|
|
|
delete dynamic_cast<QCryptographicHash*>( self );
|
|
|
|
} else {
|
|
|
|
delete self;
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|