By combining the docs for QCryptographicHash and QString with a splash of QByteArray:
QString fileName
("/home/ubuntu/pics/pic1.jpg");
QCryptographicHash hash(QCryptographicHash::Md5);
hash.addData(fileName.toLatin1());
qDebug() << hash.result().toHex();
qDebug() << QCryptographicHash::hash(fileName.toLatin1(), QCryptographicHash::Md5).toHex();
QString fileName("/home/ubuntu/pics/pic1.jpg");
QCryptographicHash hash(QCryptographicHash::Md5);
hash.addData(fileName.toLatin1());
qDebug() << hash.result().toHex();
qDebug() << QCryptographicHash::hash(fileName.toLatin1(), QCryptographicHash::Md5).toHex();
To copy to clipboard, switch view to plain text mode
you get
"d615b7ea2e9c46cc84125e638e6e16f0"
"d615b7ea2e9c46cc84125e638e6e16f0"
"d615b7ea2e9c46cc84125e638e6e16f0"
"d615b7ea2e9c46cc84125e638e6e16f0"
To copy to clipboard, switch view to plain text mode
Feel free to verify the correctness.
Bookmarks