MD5_file function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Neron
Forum Newbie
Posts: 5
Joined: Sun Oct 16, 2005 6:11 pm
Location: Bolivia / Switzerland

MD5_file function

Post by Neron »

Hi !

With the PHP MD5_file function I want to check if a file was modified. So I get the MD5 hash when I created the file and then after a while I can check if the file was modified by someone else if I check the MD5 hash of the file again.

That works pretty good but I'm not sure if the hash is equal on all php versions 4.4 and 5.0.x as an example. Does someone knows anything about that ?

I think the MD5 hash for a unmodified file should be the same on all systems, versions and so on... or am I wrong ?

Thank's a lot for your help !!!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the resultant hash is dictated by the algorithm, which has not changed between versions of the language. The implementation may vary, but the result of a given binary stream is required to be the same, always.
User avatar
Neron
Forum Newbie
Posts: 5
Joined: Sun Oct 16, 2005 6:11 pm
Location: Bolivia / Switzerland

Thank's a lot feyd !

Post by Neron »

Thank's a lot for your explication. That helped. I think if it would not be like that then if mysql (or any other company..) provides the hash of their downloads, the visitor who downloads the file can't check it...

Best Regards and thank's !! :)
Post Reply