-
December 16th, 2009, 08:04 AM
#1
Comparing 2 Files?
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.
-
December 16th, 2009, 09:24 AM
#2
Re: Comparing 2 Files?
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.
-
December 17th, 2009, 04:24 AM
#3
Re: Comparing 2 Files?
Thank you for the help! It cleared everything up for me.
-
December 17th, 2009, 08:03 AM
#4
Re: Comparing 2 Files?
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 ?
Regards,
Ramkrishna Pawar
-
December 17th, 2009, 09:03 AM
#5
Re: Comparing 2 Files?
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|