Qt Core module
- Add linking against the module library:
If building project with CMake then use the find_package()
command to locate the needed module:
find_package(Qt5 COMPONENTS Core REQUIRED)
target_link_libraries(myapp Qt5::Core)
- Generate SHA-1 hash:
#include <iostream>
#include <QCoreApplication>
#include <QCryptographicHash>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QString text = "Hello";
QByteArray bytes = QCryptographicHash::hash(text.toUtf8(), QCryptographicHash::Sha1);
QString digest = QString(bytes.toHex());
std::cout << digest.toStdString() << std::endl;
return app.exec();
}
Leave a Comment
Cancel reply