jessek / hashdeep

Other
706 stars 132 forks source link

Inconsistent file ordering when generating checksums #393

Open superbonaci opened 4 years ago

superbonaci commented 4 years ago

Performed md5deep -r folder/ several consecutive times, my surprise is that each time the file order may differ, even if the contents are exactly the same. For example:

First checksum generation:

md5deep -r folder/ > 1.md5
xxxx  clonezilla.iso
xxxx  debian.iso
xxxx  gparted.iso
xxxx  Mac.iso
xxxx  archlinux.iso
xxxx  memtest86-usb.zip

Second checksum generation:

md5deep -r folder/ > 2.md5
xxxx  clonezilla.iso
xxxx  gparted.iso
xxxx  debian.iso
xxxx  Mac.iso
xxxx  memtest86-usb.zip
xxxx  Microsoft.exe

I can't perform any diff 1.md5 2.md5 because the order differs, have to sort them first. Can this be fixed or the file list is randomly generated then checksum is performed?

superbonaci commented 4 years ago

Maybe it's because of this: https://github.com/jessek/hashdeep/issues/394

paulhargreaves commented 4 years ago

Do this: diff <(sort 1.md5) <(sort 2.md5)