Blend file hash keeps changing I am trying to compare hashes of blend files, but I'm running into a few problems. Every time I open Blender and write the default cube mesh to another file and then hash that file, the hash is different. I run the following code from the python console:

from hashlib import sha1
bpy.data.libraries.write('//Lib.blend', {C.object.data})
sha1(open(bpy.path.abspath('//Lib.blend'), 'rb').read()).hexdigest() // resulting hash, different every time


This also happens when I, for example, switch to and from edit mode without altering the mesh. Every time, another hash.

I've been searching the API and the source code to see whether a timestamp is added to the blend file, but have been unable to find anything. Interestingly, when I execute the above code twice without re-opening or editing any object in the scene, the hashes do remain the same.

What causes the hashes to keep changing, even though the data is the same?
I was interested in this so did a little research.

A blender save works by directly copying the scene data from memory to disk. This makes the save fast since there is no need for a 'conversion' stage.

This means that any change to how that data is in memory will result in the same change when in a blend file. This could be trivial changes like the order of variables in a list.

read this for more details: http://archive.blender.org/development/architecture/blender-file-format/

"Blend-files can be different when stored on different hardware platforms or Blender releases. There is no effort taken to make blend-files binary the same."

Basically it means that hashing the file cannot be used to check for content changes.

R