Re: md5 sum integrity check for downloaded PHP tarball?
| From: | Danny Shepherd | Date: | Tue, 06 Aug 2002 15:18:40 +0000 |
| Subject: | Re: md5 sum integrity check for downloaded PHP tarball? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111387@lists.php.net to get a copy of this message | ||
Try
<?php
if (!function_exists('md5_file'))
{
// Function only exists in PHP4.2.2+
// So we'll add it manually if it's not present
function md5_file($inFile)
{
if (file_exists($inFile))
{
$fd = fopen($inFile, 'rb');
$fileContents = fread($fd, filesize($inFile));
fclose ($fd);
return md5($fileContents);
}
else
return false;
}
}
//$downloadedapp = path/to/your/downloaded/app
//$publishedMD5string = md5string you want to use in the comparison
if (md5_file($downloadedapp)==$publishedMD5String)
echo "File & md5string match - file is Ok";
else
echo "File & md5string are different, wrong/corrupt file or md5string";
?>
HTH
Danny.
----- Original Message -----
From: "Ian Ball" <ian23@midori.shacknet.nu>
To: <php-general@lists.php.net>
Sent: Tuesday, August 06, 2002 3:56 PM
Subject: [PHP] md5 sum integrity check for downloaded PHP tarball?
> Hi,
>
> I am just wondering if there is any possibility to check the integrity of
a
> downloaded PHP tarball with a published md5 sum or similar from somewhere.
> This needs to be done because of security concerns in the company I work
for.
> I've looked around on the PHP site but didn't find anything.
>
> Ian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>