Binary Diff Utility

  • Thread starter Thread starter R I G Consulting, Inc.
  • Start date Start date
R

R I G Consulting, Inc.

I am looking for a microsoft or public domain tool that can diff two
binary files (exe, lib or DLL) and able to concur if they are
identical or not *ignoring* the header details such as time stamps.
The idea is to find if two binary files built during two different
time period are identical.

The binary files are built using .NET 2008 version, if that matters.

Please repond to the posting or reply to e-mail. Suggestions and
existing tools, pointers to MSDN are welcome. MVP replies are most
apperciated.

TIA
rigconsulting@[nospam]yahoo.com
 
I am looking for a microsoft or public domain tool that can diff two
binary files (exe, lib or DLL) and able to concur if they are
identical or not *ignoring* the header details such as time stamps.
The idea is to find if two binary files built during two different
time period are identical.

The binary files are built using .NET 2008 version, if that matters.

Please repond to the posting or reply to e-mail. Suggestions and
existing tools, pointers to MSDN are welcome. MVP replies are most
apperciated.

You say you want to know if it's identical or not? So you're just looking
for a true/false if the files are the same?

If so, just take a hash of each and compare them, the bigger the hash the
less likely collisions (of course they are pretty unlikely anyway for such
an application).

I notice someone has already written one, bound to be many about though:
http://corz.org/windows/software/checksum/

Or if you want to write one, see:

http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha1.aspx
http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha512.aspx


IF you want to compare every single byte and list differences, you can just
File.GetAllBytes() the files you want, step through each of them in a for
loop a byte at a time and not the differences.
 
I really like WinMerge. It can handle entire folders, text files, and will
support binary files as well.

Brian
 
R I G Consulting said:
I am looking for a microsoft or public domain tool that can diff two
binary files (exe, lib or DLL) and able to concur if they are
identical or not *ignoring* the header details such as time stamps.
The idea is to find if two binary files built during two different
time period are identical.

The binary files are built using .NET 2008 version, if that matters.

You may have a look at Microsoft's bindiff.exe in the XP Support
Tools package. It works for simple cases, such as an unmanaged C
"hello world" built with the default settings. Does not necessarily work
with all combinations of compiler/debug options and other languages.
If you need finer control, you can always dumpbin.exe the relevant
(to you) PE sections and compare them externally.

Liviu
 
Brian Muth said:
I really like WinMerge. It can handle entire folders, text files, and will
support binary files as well.

Vote #2 for WinMerge. It compares 2 folders, like what changed between 2
projects and it does binary comparison for binary files. It shows "Binary
files are identical" so you know it did binary comparison(based on file
extension).

You could also use "FC" which is part the OS since the DOS days. Example:

fc /b file1 file2

Use "fc /?" to see the command line options.
 
I am looking for a microsoft or public domain tool that can diff two
binary files (exe, lib or DLL) and able to concur if they are
identical or not *ignoring* the header details such as time stamps.
The idea is to find if two binary files built during two different
time period are identical.

When building the same project twice, the resulting binary differs,
since pdb guids and maybe timestamps are incoperated. U can use
dumpbin to compare only the content, which is described in kb article
Q164151.
 
When building the same project twice, the resulting binary differs,
since pdb guids and maybe timestamps are incoperated. U can use
dumpbin to compare only the content, which is described in kb article
Q164151.

That article is rather old and referring to VC v6, though the principles
still apply. It likely predates the bindiff.exe utility I mentioned in
my other post, which appears to have been originally meant to automate
such comparisons (and does still work in non-debug/unmanaged cases).

Unfortunately, bindiff itself hasn't been actively maintained in a
while, and is missing a number of options relevant to real life usage,
such as ignoring .pdb paths and timestamps.

So, yes, dumpbin is the last resort as always, but I still wish there
were a more direct and painless way to verify "reproducible builds".

Liviu
 
Back
Top