parent
3d45f5a57f
commit
922ff5bce5
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of MXE. See LICENSE.md for licensing information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QtCrypto>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef QT_STATICPLUGIN
|
||||||
|
#include "import_plugins.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
QCA::init();
|
||||||
|
|
||||||
|
QByteArray inputString = "Hello world!";
|
||||||
|
if (a.arguments().size() > 1) {
|
||||||
|
inputString = a.arguments().at(1).toUtf8();
|
||||||
|
}
|
||||||
|
std::cout << "input string:\n" << inputString.toStdString() << "\n\n";
|
||||||
|
|
||||||
|
// Calculate hashes of a string with all available hashing algorithms:
|
||||||
|
QByteArray outputString;
|
||||||
|
for (const QString &hastType : QCA::Hash::supportedTypes()) {
|
||||||
|
QCA::Hash hashObject(hastType);
|
||||||
|
hashObject.update(inputString);
|
||||||
|
outputString = hashObject.final().toByteArray().toHex();
|
||||||
|
|
||||||
|
std::cout << hastType.toStdString() << " hash:\n"
|
||||||
|
<< outputString.toStdString() << "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
# This file is part of MXE. See LICENSE.md for licensing information.
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): TARGET = test-qca5
|
||||||
|
else: TARGET = test-qca
|
||||||
|
SOURCES += qca-test.cpp
|
||||||
|
CONFIG += crypto console
|
||||||
|
QMAKE_CXXFLAGS += -Wall -Werror
|
||||||
|
|
||||||
|
# For static linking:
|
||||||
|
# QTPLUGIN += qca-gnupg qca-logger qca-ossl qca-softstore qca-qt5
|
||||||
|
# LIBS += -L$$[QT_INSTALL_PLUGINS]/crypto
|
||||||
|
|
Loading…
Reference in new issue