Discussion:
Binary Diff Utility
(too old to reply)
R I G Consulting, Inc.
2010-03-10 22:19:36 UTC
Permalink
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
Mike Lovell
2010-03-10 22:30:18 UTC
Permalink
Post by 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.
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.
--
Mike
GoTinker, C# Blog
http://www.gotinker.com
Brian Muth
2010-03-10 23:27:10 UTC
Permalink
I really like WinMerge. It can handle entire folders, text files, and will
support binary files as well.

Brian
Nobody
2010-03-11 00:48:19 UTC
Permalink
Post by Brian Muth
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.
Nobody
2010-03-11 01:01:40 UTC
Permalink
Links:

http://en.wikipedia.org/wiki/WinMerge
http://winmerge.org/
Liviu
2010-03-11 00:24:32 UTC
Permalink
Post by 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.
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
g***@hotmail.com
2010-03-11 22:42:54 UTC
Permalink
Post by 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.
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.
Liviu
2010-03-12 05:46:39 UTC
Permalink
Post by g***@hotmail.com
Post by 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.
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

Loading...