c++ - 如何实现二进制文件对比
ringa_lee
ringa_lee 2017-04-17 13:48:28
0
1
765

如题。我需要实现一个类似于Hex Comparison这样的工具。Hex的实现不成问题,就是想知道如何实现两个二进制文件的对比?不需要合并只需要对比。 有现成的轮子可以让我直接调用然后得到两个文件的差异吗?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
大家讲道理

Provide several methods for reference:

  1. Using the diff/cmp command on the command line, you can determine whether the two binaries are exactly the same:

    diff file1 file2
    cmp -b file1 file2

  2. hexdump under the command line, after getting the hex text, use diff to compare the hex text of the two files:

    hexdump file1.bin > file1.hex
    hexdump file2.bin > file2.hex
    diff file1.hex file2.hex

  3. Calculate the MD5 or SHA1 of these two files. If the hash values ​​obtained are the same, they are the same file

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!