note 19939 added to function.md5

From: Date: Fri, 15 Mar 2002 19:53:31 +0000
Subject: note 19939 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-27840@lists.php.net to get a copy of this message
In reference to the comment made by boulat@inet-interactif.com about getting the MD5 hash of a file, that example given is not binary safe. Since I am running PHP4.1.2 and the md5_file is not included yet in the source code, here is a binary safe PHP-code function to do the same thing if anyone else wants it: This function is: function md5_of_file($inFile) { if (file_exists($inFile)) { $fd = fopen($inFile, 'r'); $fileContents = fread($fd, filesize($inFile)); fclose ($fd); return md5($fileContents); } else { return false; } } -- http://www.php.net/manual/en/function.md5.php http://master.php.net/manage/user-notes.php?action=edit+19939 http://master.php.net/manage/user-notes.php?action=delete+19939 http://master.php.net/manage/user-notes.php?action=reject+19939

« previous php.notes (#27840) next »