6

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.

2

2 Answers 2

8

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).

1

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

1
  • bsdiff looks like xdelta, wonder wich generates the smaller binary patch tho.. Commented May 24, 2016 at 3:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .