Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Mugen Wizardry
User Banned
Posted: 22nd Jan 2011 02:21
Hi all. I'm having a bit of a problem comparing 1 file with another.

for now i have them both in the same folder, but when i release my program to the public, i would like 1 file to be in 1 place, and the other to be in the other place, and compare files. if 1 is not EXACTLY the same as the other, then u've hacked the file. if 1 of the files are missing then uve deleted on purpose or hacked the file.

i would like a simple answer plz & thank you

Here is the code I wrote:



thanks! ^^

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 22nd Jan 2011 02:41
Check the length of the files. If the lengths aren't equal, then they can't match.

If the sizes are the same, then compare the raw data.

--> Load the data from file #1 into a memory bank
--> Load the data from file #2 into a memory bank

----> Loop through each byte and compare them. If any bytes aren't the same, the files don't match.

mr_d
DBPro Tool Maker
19
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Somewhere In Australia
Posted: 24th Jan 2011 02:51
As Kevin said, first compare sizes to get a "rough" compare result, and if they are the same size then go further.
If the files are relatively small (say less than about 2Mb) then a byte by byte compare would be fine, if they are larger then I'd go with another method; maybe better to compare the hash of each file.
IanM's Matrix plugin has lots of hash functions that would suffice.

(\___/)
(='.'=) Copy bunny into your signature to
("_(" help him gain world domination.

Login to post a reply

Server time is: 2026-07-16 12:19:55
Your offset time is: 2026-07-16 12:19:55