while (!(buffer->get(&data) || abort));
- hash.addData(QCryptographicHash::hash(data, QCryptographicHash::Md4));
+ // If file is one chunk don't hash it twice
+ if (totalSize < ED2K_PART_SIZE)
+ hash.addData(data);
+ else
+ hash.addData(QCryptographicHash::hash(data, QCryptographicHash::Md4));
read += data.size();
emit progress(read, totalSize);
}
buffer->reset();
+ // The "red" ed2k hash
+ if (totalSize % ED2K_PART_SIZE == 0)
+ {
+ hash.addData(QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md4));
+ }
+
if (abort)
return;