6

Do you know Unix/Linux diff(1) tool works? It shows which lines were added and removed between 2 text files, and shows it in the human-readable form. I need the same kind of tool for binary files - except for working on sequences of bytes, not text lines. It still must produce human-readable output (in hex thus).

Note that I don't need cmp -l which diffs binary files byte by byte and can't detect insertions and removals. Note that I don't need xdelta or bsdiff which produce non-human-readable output. Actually, I'm a bit astonished that neither xdelta nor bsdiff offer some kind of human-readable representation for patches they produce. IMHO, such option should be there first, and only then an option to produce an efficient binary patch. After all, how the authors of those tools verify them to work right? And don't they think users will want to verify them either, to make sure that they indeed produce sane and minimal patches?

3
  • Why not convert the two files into hex and then diff the hexed versions? Commented Jan 12, 2012 at 18:51
  • If you convert to just hex values, w/o offset, then resulting diff won't convey strict information - it could be used as heuristical measure of how files are different, not to analyze differences, or be used as a patch. If convert with offset information, you immediately get spurious diffs on first insertion/deletion. So, it must be a smarter, special-purpose tool, not a quick hack. And existing tool ("how to write such tool?" I would post on StackOverflow).
    – pfalcon
    Commented Jan 12, 2012 at 19:20
  • New kind on the block docs.werwolv.net/imhex/views/diffing ImHex has a couple of non-trivial algorithms that can detect insertions/deletions on binary files. Commented Jun 12 at 3:14

1 Answer 1

3

I have found jdiff. Probably, this tool you looking for.

JDIFF is a program that outputs the differences between two binary files, either in binary format or in human readable format (detailed or summarized). JPATCH then allows to reconstruct the second file from the first file.

update

It looks like jdiff is not save patch in the human readable format. It shows only summary in human readable format :(

I research many tools and found only cracker tools can be helpful for this purpose: So human readable format is .XCK and .CRK file extensions. tools for these extensions:

for using patch:

  1. Cracker.Exe by Corner Crackers
  2. patch-xck.rb

for creating patch:

  1. c2c (compare to crack) ex: C2C by Nimnull, C2C/2 by SkullC0DEr, MC2C by MaD k0DeR.
  2. fc
1
  • 1
    jdiff appears to generate a binary patch by itself, whereas jdiff -l prints a wall of text (one line per byte changed) and jdiff -r prints regions of matching/changed/added bytes.
    – nyanpasu64
    Commented Feb 5, 2022 at 11:35

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