note 46176 deleted from function.md5 by tomsommer
| From: | tomsommer@php.net | Date: | Fri, 01 Oct 2004 20:46:34 +0000 |
| Subject: | note 46176 deleted from function.md5 by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77710@lists.php.net to get a copy of this message | ||
Note Submitter: Acecool - Acecoolco.com
----
If you want to hash a file, and it appears different on windows / linux, its because of the \n \r
difference (Thanks Rogue)
To get the REAL hash of a file use:
<?php
function Strip_NR($String) {
$Sea[] = "/\n/i";
$Sea[] = "/\r/i";
$Rep[] = "";
$String = preg_replace($Sea, $Rep, $String);
return $String;
}
$File = "./file.php";
$Hash = md5(Strip_NR(file_get_contents($File)));
?>