note 19939 deleted from function.md5 by jimw

From: Date: Sat, 08 Feb 2003 19:47:52 +0000
Subject: note 19939 deleted from function.md5 by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43628@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; } }

« previous php.notes (#43628) next »