Tool for 3-Way Binary (Hex) File Comparison?

后端 未结 5 1565
温柔的废话
温柔的废话 2021-02-10 11:05

I have a set of binary configuration files with three versions each -- an original, and two differently-modified versions of each file. I need to be able to see the differences

相关标签:
5条回答
  • 2021-02-10 11:43

    The screenshot is from Araxis Merge. Their pro edition ($270) supports 3-way compares.

    0 讨论(0)
  • 2021-02-10 11:44

    You could have a look to ECMerge (a tool I work on), it has a 2 and 3-way diff of binary files (HEX + ASCII). There is no merge feature. You can move from changed area to change area easily and compact long zones (long insertions, changes or unchanged).

    0 讨论(0)
  • 2021-02-10 11:45

    I was recently introduced to p4merge, which appears to also support binary files.

    It takes 3 files as input: The original and two derivatives. It shows them side-by-side, with a fourth window that shows the merged file, with editing capabilities and conflict resolution.

    I just used this to merge two branches of a large codebase, and it was extremely convenient.

    p4merge example

    Now, I haven't used it to merge binary files, but it does support diffing pictures, so I'd be surprised if binaries weren't supported.

    0 讨论(0)
  • 2021-02-10 11:56

    Vim has a built-in diff tool that can compare an arbitrary number of files. It also runs on Windows. You can find it at http://vim.org.

    The standard installation of vim for windows includes xxd, which allows you to see binary files as text:

    So for example if you try:

    xxd xxd.exe
    

    you'll get:

    0000000: 4d5a 9000 0300 0000 0400 0000 ffff 0000  MZ..............
    0000010: b800 0000 0000 0000 4000 0000 0000 0000  ........@.......
    0000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
    0000030: 0000 0000 0000 0000 0000 0000 d800 0000  ................
    0000040: 0e1f ba0e 00b4 09cd 21b8 014c cd21 5468  ........!..L.!Th
    0000050: 6973 2070 726f 6772 616d 2063 616e 6e6f  is program canno
    0000060: 7420 6265 2072 756e 2069 6e20 444f 5320  t be run in DOS 
    0000070: 6d6f 6465 2e0d 0d0a 2400 0000 0000 0000  mode....$.......
    0000080: 6ba7 bec3 2fc6 d090 2fc6 d090 2fc6 d090  k.../.../.../...
    

    etc...

    So you can use xxd to dump your binary files into text files:

    xxd orig > orig.txt
    xxd mod1 > mod1.txt 
    xxd mod2 > mod2.txt
    

    And then run vim in diff mode:

    vim -d orig mod1 mod2
    

    And this will give you something like this:

    example of 3-way vimdiff

    (This screenshot was taken from here and is no more than an illustration of what a 3-way diff will look like in VIM)

    All of these tools are available in windows, so they should solve your problem.

    Edit:

    After you merge the results of xxd, you can convert the hex dump into a binary file using xxd -r:

    xxd -r merged_xxd_file merged_binary_file
    

    You can see more details and options in xxd's manpage

    0 讨论(0)
  • 2021-02-10 12:00

    The latest version of Beyond Compare seems to support 3-way diff and merge. Moreover, its feature list says it supports comparison of binary files.

    Note that this is not free software :-)

    0 讨论(0)
提交回复
热议问题