note 14119 added to index.php
| From: | Hayan Al Mamoun | Date: | Wed, 18 Jul 2001 08:34:53 +0000 |
| Subject: | note 14119 added to index.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15526@lists.php.net to get a copy of this message | ||
Here are two functions for encrypting and de-encrypting words, can be used for security purposes :
<?
function cyb_encrypt($word,$password){
$y=0;
for ($x=0;$x<strlen($word);$x++)
{
$ret .= chr(ord(substr($word,$x,1)) + ord(substr($password,$y,1)));
$y++;
if($y> strlen($password)){$y=1;}
}
return $ret;
}
function cyb_deencrypt($word,$password){
$y=0;
for ($x=0;$x<strlen($word);$x++)
{
$ret .= chr(ord(substr($word,$x,1)) - ord(substr($password,$y,1)));
$y++;
if($y> strlen($password)){$y=1;}
}
return $ret;
}
?>
http://www.php.net/manual/en/index.php