Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Binary Diff Utility

88 views
Skip to first unread message

R I G Consulting, Inc.

unread,
Mar 10, 2010, 5:19:36 PM3/10/10
to
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

unread,
Mar 10, 2010, 5:30:18 PM3/10/10
to

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

unread,
Mar 10, 2010, 6:27:10 PM3/10/10
to
I really like WinMerge. It can handle entire folders, text files, and will
support binary files as well.

Brian

Liviu

unread,
Mar 10, 2010, 7:24:32 PM3/10/10
to
"R I G Consulting, Inc." <rig_p...@yahoo.com> wrote...

>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

Nobody

unread,
Mar 10, 2010, 7:48:19 PM3/10/10
to
"Brian Muth" <bm...@mvps.org> wrote in message
news:132C3F08-0D29-4E7B...@microsoft.com...

>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

unread,
Mar 10, 2010, 8:01:40 PM3/10/10
to

gas...@hotmail.com

unread,
Mar 11, 2010, 5:42:54 PM3/11/10
to
On 10 mrt, 23:19, "R I G Consulting, Inc." <rig_pos...@yahoo.com>
wrote:

> 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

unread,
Mar 12, 2010, 12:46:39 AM3/12/10
to
<gas...@hotmail.com> wrote...

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

0 new messages