From f1bbf0c42e357faace5ef4507229c49761424df2 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 12 Mar 2022 00:16:43 +0200 Subject: [PATCH] read the file in chunks from filehash utility Signed-off-by: Ivailo Monev --- util/filehash/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/filehash/main.cpp b/util/filehash/main.cpp index 22681122b..01743ca2d 100644 --- a/util/filehash/main.cpp +++ b/util/filehash/main.cpp @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) const QStringList args = app.arguments().mid(1); if (args.size() != 2) { - qWarning() << "Usage: imgconv "; + qWarning() << "Usage: filehash "; return 1; } @@ -58,7 +58,9 @@ int main(int argc, char *argv[]) return 3; } - const QByteArray hash = QCryptographicHash::hash(file.readAll(), algorithm).toHex(); + QCryptographicHash cryptohash(algorithm); + cryptohash.addData(&file); + const QByteArray hash = cryptohash.result().toHex(); if (hash.isEmpty()) { qWarning() << "Could not hash" << args.at(1); return 4;