Jump to content

Best Function/Feature for Comparing Files..?


Recommended Posts

Nah, i mean like crc32, md5 checksums Ect..

Whats the best fastest way to compare 2 or more files against each other to see if they are same/diff..??

md5 I think.

I wrote an MD5 checksum tool using MD5Hash.dll from a UDF here on the Forums. It was for Trusted Downloads Process when you take unclass information off a secret pc.. so it's good enough to get approved for that lol.

The tool asks for two files using filedialog functions and compares them in a gui I made with KODA. If you want me to share the app PM me please.

I hope this helps,

avery

ps:Zzzzzz

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org
Link to comment
Share on other sites

SMF utilizes the pure Autoit md5 calculation UDF by Ward:

http://www.autoitscript.com:80/forum/index...showtopic=76976

You can either use it to calculate the full original md5 hash (can be time consuming) or use the md5(short) mechanism I created especially for SMF (:)). Depending on file-type you can define chunks of the file to calculate the md5 on, e.g. 5KB or 5MB or any other chunk-size. md5(short) then takes the first chunk, a middle chunk and the last chunk of the file to calculate the md5. Especially on large files this gives a major speed improvement with acceptable accuracy (in my experience). SMF detects duplicates by first comparing the filesize in byte and then calculates md5(short) only for those files with same filesize.

The relevant function in SMF is 'md5_calc($filename = "", $type = 1)', type 1 means full, type 2 means short (+some additional checks which you might to have to cut out). The relevant include is SMF_MD5_v03.au3.

Edited by KaFu
Link to comment
Share on other sites

so which method is the best/fastest/accurate method to compare 2 files..??

Check the sizes, and if they are equal, use that cool UDF from that thread to calculate the CRC32 for each. Then compare those 2 results. Should be very easy to do, please don't ask for code, lol.
Link to comment
Share on other sites

They all work fine, I think CRC32 is faster, the others are more "secure" and less susceptible to brute forcing. If you are afraid of faked CRC32, don't use it. If you don't care about speed, use another.

But I believe any of these would work fine.

And if you have hours to kill ...

http://en.wikipedia.org/wiki/Sha1

http://en.wikipedia.org/wiki/Crc32

http://en.wikipedia.org/wiki/Md5

Edited by Inverted
Link to comment
Share on other sites

so SHA1 is a better one to go with then..

Im not really using it for security purposes.. its just guna be used to compare files that are going to be moved & copied Ect.. to see if they are same/diff Ect.. and do If/Then Based function base upon if the files are same or diff..

Link to comment
Share on other sites

There is nothing changed when moving a file relating to it's byte array concept. What might get change is what referring this file so moving a .exe file that rely on some .dll's or some regkey's that rely on file's location might not work if that is the case. Other than that nothing is change in the byte array concept.

Link to comment
Share on other sites

Here is a function I use to compare two files -- checks size first, then [last modified] date if the size is identical. It's not nearly as complex as the other script listed, but it seems to get the job done.

If the destination location is different, it copies the file from the source location.

CompareTwoFiles_CopyIfDifferent.au3

Edited by rogerd2u

Roger O."When people show you who they are, believe them.” --Mark Twain

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...