function my_stream_cipher($plaintext, $key)
{
$ciphertext = $plaintext;
$sha = sha1($key);
for ($i = 0; $i < 5; $i++)
{
mt_srand( hexdec( substr($sha, ( $i * 8 ), 8 ) ) );
for ($j = 0; $j < strlen($plaintext); $j++)
$ciphertext{$j} = chr( ord( $ciphertext{$j} ) ^ mt_rand(0, 255) );
}
return $ciphertext;
}