note 46177 added to function.md5-file

From: Date: Fri, 01 Oct 2004 13:51:19 +0000
Subject: note 46177 added to function.md5-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-77681@lists.php.net to get a copy of this message
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))); ?> ---- Manual Page -- http://www.php.net/manual/en/function.md5-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46177 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46177&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46177&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77681) next »