public static function cipher($text, $key)
{
if (empty($key)) {
trigger_error('You cannot use an empty key for Security::cipher()', E_USER_WARNING);
return null;
}
if (!defined('CIPHER_SEED')) {
define('CIPHER_SEED', '76859309657453542496749683645');
}
srand(CIPHER_SEED);
$output = '';
for ($i = 0; $i < strlen($text); $i++) {
for ($j = 0; $j < ord(substr($key, $i % strlen($key), 1)); $j++) {
rand(0, 255);
}
$mask = rand(0, 255);
$output .= chr(ord(substr($text, $i, 1)) ^ $mask);
}
return $output;
}