note 87235 added to function.sha1-file
| From: | GoodlookinguyatNRG' | Date: | Wed, 26 Nov 2008 03:01:27 +0000 |
| Subject: | note 87235 added to function.sha1-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146967@lists.php.net to get a copy of this message | ||
In php 5.1.2 and above, the alternative to using this could be this little bit I wrote. It can be
used for other hashes as well.
<?php
/* $by : Nicholas
$date : 11/25/08
$site : http://nrgsrpg.com
$copyright: This can be redistributed at will.
*/// $des : For Hashing Files in all sorts of ways
class hashing {
public static function filehash($file,$hash) {
if (file_exists($file)) {
return hash($hash,file_get_contents($file));
}
else {
return "Error Occurred: File Does Not Exist";
}
}
}
echo hashing::filehash("index.php","sha1")."<br />";
echo hashing::filehash("index.php","whirlpool")."<br />";
echo hashing::filehash("index.php","sha512");
?>
Have fun!
----
Server IP: 209.41.74.194
Probable Submitter: 75.15.246.227
----
Manual Page -- http://www.php.net/manual/en/function.sha1-file.php
Edit -- https://master.php.net/note/edit/87235
Del: integrated -- https://master.php.net/note/delete/87235/integrated
Del: useless -- https://master.php.net/note/delete/87235/useless
Del: bad code -- https://master.php.net/note/delete/87235/bad+code
Del: spam -- https://master.php.net/note/delete/87235/spam
Del: non-english -- https://master.php.net/note/delete/87235/non-english
Del: in docs -- https://master.php.net/note/delete/87235/in+docs
Del: other reasons-- https://master.php.net/note/delete/87235
Reject -- https://master.php.net/note/reject/87235
Search -- https://master.php.net/manage/user-notes.php