This is an old revision of the document!


diff across two binary files in hexview

lets say you have two binary files you want to compare in order to find differences in single bytes..

there is ghex for exmaple that nicely displays a hex file with bytes to the left (16 per row) and ascii characters to the right. wouldn't it be nice to be able to use this view in a diff?

thanks to hexdump, this can be done with any regular diff tool, be it a graphical one like diffuse or just diff on the cli.

here is the hexdump line to convert a binary into a nicely looking text file for comparison:

hexdump -e '16/1 “%02X ”“\t”“ ”' -e '16/1 “%c”“\n”' generated.bin > generated.txt

this will return something like this:

52 57 FD 00 00 00 00 00 00 00 00 00 00 00 00 00  RW<FD>^@^@^@^@^@^@^@^@^@^@^@^@
^@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
^@
*
52 57 FD 00 00 00 00 00 00 00 00 00 00 00 00 00  RW<FD>^@^@^@^@^@^@^@^@^@^@^@^@
^@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@