Hey I'm trying to compare 2 binaries, like when a project is updated. I want to the comparer to be able to see what % of the bytes are different than from before. Would I be able to do something like comparing a text file? I know the contents of a exe are far different from that of a text, but I'm not entirely sure how I could go about this.
You just open both files in binary mode and compare every byte.
Of course, reading byte per byte is slow, so better is to read a block of bytes, say 256KB into a memory buffer and then compare the memory buffers.
Comparing the exe contents is not a good idea, reason is, if the exe just have updated for new constant variable string the exe format would push down the stuf and then you would find 90% of difference, but actually only few bytes were added.
Instead, compare the creation time stamp. Why do you need to compare binaries by the way ?
You are right, but it just depends on how you interpret "difference". When I replied I assumed "difference" meant the real different bytes. So, even if your exe has just an updated constant variable string and pushes 90% of the rest of the exe down, this means that 90% of the bytes are different, even thought they are just move a bit, it's still different.
Bookmarks