Fastest way to check if two large files are identical

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Fastest way to check if two large files are identical

Post by *Hacker »

Hi all,
What is the fastest way to check if two large files (eg. DVD or Blu-ray ISO images) are identical or not? Compare by contents is incredibly slow (even if I had enough memory), creating MD5 hashes for both files and comparing them instead is faster. Is there perhaps a way to create some hashes and compare them automatically (without AHK, etc.)? Or is there some other way to check if two files are identical that would be faster than compare by contents?

Thanks
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Open files in HxD, press Ctrl+K...
http://mh-nexus.de/en/hxd/

Files aren't loaded into RAM, in opposite to the useless TC compare.
This account is for sale
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

icfu,
Will try, thanks.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

<disagree>
in opposite to the useless TC compare.
During the past few years, this useless file compare function has saved me a lot of working hours, because I frequently have to synchronize the contents of configuration files across a substantial number of Unix machines.
And this useless file compare function is quite good at comparing textfiles and allowing me to edit any difference on a case by case basis.

Comparing huge binary files is not its typical strength, though.

</disagree>
MX Linux 21.3 64-bit xfce, Total Commander 11.50 64-bit
The people of Alderaan keep on bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine.
The Prophet's Song
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

You can try my "multicore killer". :) It first computes one or more (configurable) of seven types of hashes for first file, then it does it for second file and compares the results. I wrote it when I was playing with threads programming and wanted to create something at least a little useful. So it might not be completely polished, but it works fine.

Suggested button parameters for TC: %P%S2 %T%R1

http://web.hisoftware.cz/sob/download/ChkFiles1.7z (32 and 64-bit binaries and VC2008 source)
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Sob,
Thank you, too, will try! :)

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ehab
Senior Member
Senior Member
Posts: 271
Joined: 2007-10-29, 07:41 UTC
Location: Libya

Post by *ehab »

i tried 2Gb file size and it works fine. using HxD i was surprised to see it didn't show the difference with small text file having unicode characters, however it did report that size if different. Thanks for the HxD suggestion
#181344 Personal licence
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

If anyone is interested, I have now created a Simple file compare using AutoHotkey. It first checks the file sizes, then reads data at specific points in the files and if it still does not find a difference, calculates the MD5 of the compared files.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply