#include <QtCrypto>
#include <QCoreApplication>
#include <QDebug>
#include <cstdio>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"
#endif
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
qDebug() << "This example shows hashed MAC";
QByteArray arg = (argc >= 2) ? argv[1] : "hello";
printf("HMAC(SHA1) not supported!\n");
} else {
printf(
"HMAC(SHA1) of \"%s\" with \"%s\" = [%s]\n", arg.data(), key.
data(), result.toLatin1().data());
}
return 0;
}
Convenience method for initialising and cleaning up QCA.
Definition qca_core.h:660
General class for message authentication code (MAC) algorithms.
Definition qca_basic.h:828
MemoryRegion final() override
Finalises input and returns the MAC result.
void setup(const SymmetricKey &key)
Initialise the MAC algorithm.
void update(const MemoryRegion &array) override
Update the MAC, adding more of the message contents to the digest.
Secure array of bytes.
Definition qca_tools.h:317
char * data()
Pointer to the data in the secure array.
QByteArray toByteArray() const
Copy the contents of the secure array out to a standard QByteArray.
Container for keys for symmetric encryption algorithms.
Definition qca_core.h:1264
QCA_EXPORT QString arrayToHex(const QByteArray &array)
Convert a byte array to printable hexadecimal representation.
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
Test if a capability (algorithm) is available.