84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
如题。我需要实现一个类似于Hex Comparison这样的工具。Hex的实现不成问题,就是想知道如何实现两个二进制文件的对比?不需要合并只需要对比。 有现成的轮子可以让我直接调用然后得到两个文件的差异吗?
ringa_lee
Provide several methods for reference:
Using the diff/cmp command on the command line, you can determine whether the two binaries are exactly the same:
diff/cmp
diff file1 file2 cmp -b file1 file2
hexdump under the command line, after getting the hex text, use diff to compare the hex text of the two files:
hexdump
hexdump file1.bin > file1.hex hexdump file2.bin > file2.hex diff file1.hex file2.hex
Calculate the MD5 or SHA1 of these two files. If the hash values obtained are the same, they are the same file
Provide several methods for reference:
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
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
Calculate the MD5 or SHA1 of these two files. If the hash values obtained are the same, they are the same file