file_hash questions
Camille Moulin
camille.moulin at free.fr
Wed Sep 23 22:26:22 BST 2020
Hi Tom,
On 22/09/2020 07:43, amindfv at mailbox.org wrote:
> Apologies if this is answered in the docs - a quick search didn't uncover the answers.
Generally speaking, the documentation of the file format could be
improved :-(
> I'm wondering about the "kdenlive:file_hash" property in the file XML:
>
> - Which hashing algorithm is used?
From what I understand, it's seems to be md5, but, for performance
reasons, it's calculated only on the first and last Mo of the file if
the file is bigger than 2Mo
In ./src/bin/projectclip.cpp, starting line 820:
> QFile file(clipUrl());
> if (file.open(QIODevice::ReadOnly)) { // write size and hash
> only if resource points to a file
> /*
> * 1 MB = 1 second per 450 files (or faster)
> * 10 MB = 9 seconds per 450 files (or faster)
> */
> if (file.size() > 2000000) {
> fileData = file.read(1000000);
> if (file.seek(file.size() - 1000000)) {
> fileData.append(file.readAll());
> }
> } else {
> fileData = file.readAll();
> }
> file.close();
>
> ClipController::setProducerProperty(QStringLiteral("kdenlive:file_size"),
> QString::number(file.size()));
> fileHash = QCryptographicHash::hash(fileData,
> QCryptographicHash::Md5);
> }
> - When are the hashes checked? E.g. if I save a kdenlive file, quit, then reopen it, will the hashes of the files on disk be checked?
Yes, I think so
> Are there other points at which it's checked? Can the user manually start a check?
I guess that if you reload the clip, it will check it and update it if
modified.
HTH,
Camille
More information about the kdenlive
mailing list