Skip to content

Instantly share code, notes, and snippets.

@kassane
Created July 4, 2017 20:01
Show Gist options
  • Save kassane/16956a4a2eb28c4711be82c2fa9467a8 to your computer and use it in GitHub Desktop.
Save kassane/16956a4a2eb28c4711be82c2fa9467a8 to your computer and use it in GitHub Desktop.
Hash File - Qt5
#include <QtCore>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCryptographicHash md5gen(QCryptographicHash::Md5); /*MD4, SHA1, SHA256, SHA512 ...*/
QFile file(argv[1]); //filename
file.open(QIODevice::ReadOnly);
md5gen.addData(file.readAll());
file.close();
qDebug() << file.fileName() << " Hash: "<< md5gen.result().toHex();
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment