用于三向二进制(十六进制)文件比较的工具?

发布于 2024-10-10 07:18:53 字数 394 浏览 10 评论 0原文

我有一组二进制配置文件,每个文件都有三个版本——每个文件的一个原始版本和两个经过不同修改的版本。我需要能够同时看到两个版本和原始版本之间的差异。

我需要的是一个用于二进制文件的三向比较工具。通过相当费力的 Google 搜索,我最终偶然发现了一个应用程序的屏幕截图,它完全符合我的需要 - 不幸的是,包含该图像的论坛帖子没有提及他们正在使用的应用程序:

http://www.xboxhacker.org/index.php?topic=15032.0

有人能给我指出一个(Windows)应用程序的方向,该应用程序提供三个二进制文件的二进制安全(十六进制)比较吗?

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 between the two versions as well as the original, all at the same time.

What I need is a three-way diff tool for binary files. Through a rather exhausting Google search, I eventually happened upon a screenshot of an application that does exactly what I need -- unfortunately, the forum post containing the image does not mention what application it is they're using:

http://www.xboxhacker.org/index.php?topic=15032.0

Can someone point me in the direction of a (Windows) application that provides a binary-safe (hex) comparison of three binary files??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

走野 2024-10-17 07:18:53

Vim 有一个内置的 diff 工具,可以比较任意数量的文件。它也可以在 Windows 上运行。您可以在 http://vim.org 找到它。

Windows 版 vim 的标准安装包括 xxd,它允许您将二进制文件视为文本:

因此,例如,如果您尝试:

xxd xxd.exe

您将得到:

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

等等...

所以您可以使用 xxd 将二进制文件转储到文本文件中:

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

然后以 diff 模式运行 vim:

vim -d orig mod1 mod2

这将为您提供如下内容:

example of 3-way vimdiff

(此屏幕截图取自 这里 只不过是 VIM 中 3 向 diff 的示例)

所有这些工具都可以在 Windows 中使用,因此它们应该可以解决您的问题。

编辑:

合并xxd的结果后,您可以使用xxd -r将十六进制转储转换为二进制文件:

xxd -r merged_xxd_file merged_binary_file

您可以看到更多xxd 的联机帮助页中的详细信息和选项

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

瑶笙 2024-10-17 07:18:53

屏幕截图来自 Araxis Merge。他们的专业版(270 美元)支持 3 向比较。

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

明媚殇 2024-10-17 07:18:53

你可以看看 ECMerge (我使用的一个工具),它有 2 路和 3 路差异二进制文件(十六进制 + ASCII)。没有合并功能。您可以轻松地从更改区域移动到更改区域并压缩长区域(长插入、更改或未更改)。

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

初雪 2024-10-17 07:18:53

最新版本的Beyond Compare似乎支持 3 路比较和合并< /a>.此外,其功能列表表示它支持比较二进制文件。

请注意,这不是免费软件:-)

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

暮年 2024-10-17 07:18:53

最近有人向我介绍了 p4merge,它似乎也支持二进制文件。

它需要 3 个文件作为输入:原始文件和两个衍生文件。它并排显示它们,第四个窗口显示合并的文件,具有编辑功能和冲突解决功能。

我只是用它来合并一个大型代码库的两个分支,这非常方便。

p4merge example

现在,我还没有使用它来合并二进制文件,但它确实支持比较图片,所以我如果不支持二进制文件,请感到惊讶。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文