我有以下加密代码:
function encryptData($value){
$key = "7685647tfyr65413285746352413sgfh";
$text = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
return $crypttext;
}
echo 'Encrpt: ' . encryptData('This is just a test');
输出为:Encrpt: yUB�F3�*ľ�G-�ۅd�8�f�_�X/O
我将把它放到一个 mySQL 数据库中,但不确定它是否会接受那些奇怪的字符?
我这样做正确吗?