mcrypt 问题
Function
function mcrypt($key, $input,$mode = 'E'){
$key = substr(md5($key), 0, 24);
$td = mcrypt_module_open('tripledes','','ecb','');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = '';
//进行加密
if(strtoupper($mode) == 'D')
{
$encrypted_data = mdecrypt_generic($td, $input);
}
else
{
$encrypted_data = mcrypt_generic($td, $input);
}
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $encrypted_data;
}
var_dump()
var_dump(mcrypt('122223','121212'));
结果
string 'b��t��' (length=8)
怎么解决这个问题? - _ -|||
被轮煎的鸡蛋
10 years, 1 month ago