Page 1 of 1

MD5_file function

Posted: Sun Oct 16, 2005 6:17 pm
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 !!!

Posted: Sun Oct 16, 2005 6:43 pm
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.

Thank's a lot feyd !

Posted: Sun Oct 16, 2005 6:51 pm
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 !! :)