Timeline for How to use "cmp" to compare two binaries and find all the byte offsets where they differ?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 7, 2021 at 21:52 | comment | added | fdermishin | I've edited the answer by add a correction about format of the bytes that differ. This is a not so well documented feature of cmp. I hope that the edit is appropriate. | |
Feb 7, 2021 at 21:47 | history | edited | fdermishin | CC BY-SA 4.0 |
correction: cmp prints octal byte values, but not decimal
|
Jan 12, 2012 at 3:25 | vote | accept | Lewis Denny | ||
Dec 5, 2011 at 20:14 | comment | added | Lewis Denny | Thanks heaps this is just what I wanted, i try that in the past but I did know the the numbers on the side where the offsets :) Thanks heaps! | |
Dec 5, 2011 at 15:39 | comment | added | Jonathan Leffler |
+1: this is 'the way to do it', but the problem with it is that cmp does not look for inserted or deleted material; it just checks 'if the byte at offset N in file1 the same as the byte at offset N in file2; if yes, then print nothing, else print difference'. So the files have to be very similar (eg, just some bytes in the Unix timestamp when the object files were compiled - which is built into some object files) but the rest needs to be the same. Add 3 bytes to a constant string and everything after that is different.
|
|
Dec 5, 2011 at 15:31 | history | answered | rwos | CC BY-SA 3.0 |