#native_company# #native_desc#
#native_cta#

XOR Encryption Functions

By Dustin Schneider
on August 6, 2000

Did you know you could write your own encryption functions? It’s actually
really simple, and can allow any size of keys. Here are the simple functions to do so:


function x_Encrypt($string, $key)
{
  for($i=0; $i<strlen($string); $i++)
  {
    for($j=0; $j<strlen($key); $j++)
    {
      $string[$i] = $string[$i]^$key[$j];
    }
  }

  return $string;
}

function x_Decrypt($string, $key)
{
  for($i=0; $i<strlen($string); $i++)
  {
    for($j=0; $j<strlen($key); $j++)
    {
      $string[$i] = $key[$j]^$string[$i];
    }
  }

  return $string;
}

Quite simple, eh? Try it out for yourself.
Dustin Schneider