[Ugh, I reached my maximum post count for the day again, so I have to switch back to my other account…]
exiftool apparently also reorders the dataBlocks sequentially by position when necessary on the first write to file.
So I’m not sure the best way to handle this since the sections of the before and after files that contain the raw image data are now not identical.
But after the first write, the sections of the files that contain the raw image data appear to not change on subsequent writes.
Maybe it would be better to use the sorted dataBlocks to calculate hashes, even though that’s different than my original goal of using the data as it exists in the file.
But this way, the reordered raw image data would still be immutable and not necessarily dependent on software, version, or runtime parameters.
It’s one extra step in the calculation that you’d have to port to other software implementations, e.g. one using libraw.