mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Use accelerated hashing for verification
Modern CPUs have special instructions to accelerate computing SHA hashes. The Qt QCryptographicHash code is standard C, so not taking advantage of those though. Outsource the hashing to OpenSSL that does. Shaves off some seconds during verification stage.
This commit is contained in:
parent
2c5432fe7f
commit
8048b5e47c
6 changed files with 73 additions and 7 deletions
|
@ -600,6 +600,8 @@ bool DownloadThread::_verify()
|
|||
char *verifyBuf = (char *) qMallocAligned(IMAGEWRITER_VERIFY_BLOCKSIZE, 4096);
|
||||
_lastVerifyNow = 0;
|
||||
_verifyTotal = _file.pos();
|
||||
QElapsedTimer t1;
|
||||
t1.start();
|
||||
|
||||
if (!_firstBlock)
|
||||
{
|
||||
|
@ -627,6 +629,7 @@ bool DownloadThread::_verify()
|
|||
}
|
||||
qFreeAligned(verifyBuf);
|
||||
|
||||
qDebug() << "Verify done in" << t1.elapsed() / 1000.0 << "seconds";
|
||||
qDebug() << "Verify hash:" << _verifyhash.result().toHex();
|
||||
|
||||
if (_verifyhash.result() == _writehash.result() || !_verifyEnabled || _cancelled)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue