mirror of https://git.wownero.com/dsc/mxe.git
qca: add test
This commit is contained in:
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
|
||||||
|
|
|
@ -26,4 +26,11 @@ define $(PKG)_BUILD
|
||||||
-DQCA_MAN_INSTALL_DIR="$(BUILD_DIR)/null"
|
-DQCA_MAN_INSTALL_DIR="$(BUILD_DIR)/null"
|
||||||
$(MAKE) -C '$(BUILD_DIR)' -j $(JOBS)
|
$(MAKE) -C '$(BUILD_DIR)' -j $(JOBS)
|
||||||
$(MAKE) -C '$(BUILD_DIR)' -j 1 install
|
$(MAKE) -C '$(BUILD_DIR)' -j 1 install
|
||||||
|
|
||||||
|
$(if $(BUILD_SHARED), \
|
||||||
|
mkdir '$(BUILD_DIR)/test-qca'
|
||||||
|
cd '$(BUILD_DIR)/test-qca' && '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PWD)/src/qca-test.pro'
|
||||||
|
$(MAKE) -C '$(BUILD_DIR)/test-qca' -j $(JOBS) $(BUILD_TYPE)
|
||||||
|
$(INSTALL) -m755 '$(BUILD_DIR)/test-qca/$(BUILD_TYPE)/test-qca5.exe' '$(PREFIX)/$(TARGET)/bin/')
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue