Skip to main content

file_hash - how to calculate, to substitute clip

3 posts / 0 new
Last post
Daniel06
Offline
Joined: 06/28/2010
Posts:
file_hash - how to calculate, to substitute clip

Hi,

I'd like to know what kind of hash function should I use to calculate new 'file_hash' value. I need to substitute some source clips in my project (clip video, length unchanged, only sound repaired), I've just checked sha1sum (and other sha...) md5sum ...

How to calculate hash for a clip? - to substitute clip in my-project.kdenlive file.

Daniel

3
Your rating: None Average: 3 (1 vote)
ttill
Offline
Joined: 10/14/2009
Posts:
Re: file_hash - how to calculate, to substitute clip

What happens if you just delete the hash value?
I think we should maybe add a option to turn of hashing, as this can also lead to some other problems.

hamoid
hamoid's picture
Offline
Joined: 09/16/2011
Posts:
Re: file_hash - how to calculate, to substitute clip

I was also interested in generating .kdenlive from Python, so I wanted to find out about the file_hash. I downloaded the source code and it looks like it's using the beginning and end of the file, not the whole file:

        // ... DocClipBase::getFileHash ...

        if (file.size() > 1000000*2) {
            fileData = file.read(1000000);
            if (file.seek(file.size() - 1000000))
                fileData.append(file.readAll());
        } else
            fileData = file.readAll();

        fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);