Is there a neat way to see the difference between two binary files? They are mostly the same, but some bytes are changed, and one of the files has sequences inserted in some places.

Diffing the output of xxd would work if bytes were only changed, and not inserted.

There are a few binary editors that can show differences between files, but the ones I've tried (dhex and vbindiff) don't seem to be able to detect and show insertions or deletions.

There are a number of binary diff utilities like rdiff, xdelta or bsdiff that compute the difference between two files. But the purpose is to generate patch files to be later applied to an original. You can't read those patch files to see what the differences are.

Something you can do, to visually see the difference, is to hexdump the files with one byte per line and diff the results. The line numbers will tell you the offset in the file (though beware it starts at 1, not 0):

diff -u <(od -w1 -vAn -tx1 file1) <(od -w1 -vAn -tx1 file2)

(assuming your od supports the non-standard -w option).

try using dhex or jojodiff . You can also use bsdiff.

  • bsdiff looks like xdelta, wonder wich generates the smaller binary patch tho.. – Aquarius Power May 24 '16 at 3:04

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.