【发布时间】:2021-01-04 05:06:19
【问题描述】:
我的新信使有问题。
我想加密用户的消息。
如果他们输入波斯语,我无法加密。
This is the picture of messenger's main screen
这些未定义的符号(如:�)是我的问题
我该如何处理?
我的密码
function encrypt($message){
// Store a string into the variable which
// need to be Encrypted
$simple_string = $message;
// Store the cipher method
$ciphering = "AES-128-CTR";
// Use OpenSSl Encryption method
$iv_length = openssl_cipher_iv_length($ciphering);
$options = 0;
// Non-NULL Initialization Vector for encryption
$encryption_iv = '1234567891011121';
// Store the encryption key
$encryption_key = "SparkSocial";
// Use openssl_encrypt() function to encrypt the data
$encryption = openssl_encrypt($simple_string, $ciphering,
$encryption_key, $options, $encryption_iv);
return $encryption;
}
function decrypt($code){
// Store the cipher method
$ciphering = "AES-128-CTR";
// Non-NULL Initialization Vector for decryption
$decryption_iv = '1234567891011121';
// Store the decryption key
$decryption_key = "SparkSocial";
$options = 0;
$decryption=openssl_decrypt ($code, $ciphering,
$decryption_key, $options, $decryption_iv);
return $decryption;
}
【问题讨论】:
标签: php encryption aes