这是新PHP mcrypt_generic
private function Encrypt_Decrypt($key, $message, $encrypt = true)
{
if (!isset($key) || !isset($message))
{
throw new Exception("Invalid Parameters");
}
$iv = md5(md5($key));
$output = "";
$td = mcrypt_module_open("blowfish", "", "cbc", "");
mcrypt_generic_init($td, $key, $iv);
switch ($encrypt)
{
case true:{
$output = mcrypt_generic($td, $message);
break;
}
case false:{
$output = mdecrypt_generic($td, $message);
break;
}
}
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $output;
}