After seeing the posts above and playing around for the past few days, I came up with the following functions, they are by no means going to rock the cryptographic world, but they will stop most people in their tracks :
Any comments, improvements, suggestions etc please post them here
//encrypt function
function encrypt($string, $key)
{
$crc32key = crc32key($key);
for ($i = 0; $i < strlen($string);$i++)
{
$cipher_text_array[$i] = 2(((ord(substr($string,$i,1))/2) $crc32key) * ($i+strlen($key)));
}
$cipher_text = implode("-", $cipher_text_array);
return $cipher_text;
}
//decrypt function
function decrypt($cipher_text, $key)
{
$crc32key = crc32key($key);
$encrypted_letters_array = explode("-", $cipher_text);
$encrypted_letters_array_size = sizeof($encrypted_letters_array);
for ($i=0; $i < $encrypted_letters_array_size; $i++)
{
$cipher_value = $encrypted_letters_array[$i];
$decrypted_letter_value = chr((2 * ($cipher_value / $crc32key)) / ($i+strlen($key))/2);
$decrypted_string_array[$i] = $decrypted_letter_value;
}
$decrypted_string = implode("", $decrypted_string_array);
return $decrypted_string;
}
//function to ensure the key is positive (not really needed if you implode the array in encrypt() using something other than '-', but none the less does make the cipher text look neater.
function crc32key($key)
{
$crc32key = crc32($key);
if ($crc32key < 0) {
$crc32key = (crc32($key)) * -1;
}
return $crc32key;
}