Thread: new challenge!!
View Single Post
Old 01-27-2008, 02:49 AM   #6 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

php Code:
function wildhoney_encrypt($szString)
{
    $szEncrypted = '';
    $aParts = str_split($szString, 1);
   
    foreach($aParts as $szLetter)
    {
        $szEncrypted .= chr(ord($szLetter) + 5);
    }
   
    return $szEncrypted;
}

function wildhoney_decrypt($szString)
{
    $szDecrypted = '';
    $aParts = str_split($szString, 1);
   
    foreach($aParts as $szLetter)
    {
        $szDecrypted .= chr(ord($szLetter) - 5);
    }
   
    return $szDecrypted;
}

$szString = 'Bleh';
$szEncrypted = wildhoney_encrypt($szString);
$szDecrypted = wildhoney_decrypt($szEncrypted);

echo 'Encrypted: ' . $szEncrypted . '<br />';
echo 'Decrypted: ' . $szDecrypted;

Lol Night night everybody.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote