note 46176 added to function.md5

From: Date: Fri, 01 Oct 2004 13:51:02 +0000
Subject: note 46176 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-77680@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.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46176 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46176&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46176&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77680) next »