试图加密社会安全号码,查询偶尔会工作,但每 5 到 10 次就会抛出一个
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '�9~���d�~/C�yK�~�� _', ' 50', '62' )' at line 1
SSN: _mosPEdaXEsB7zJCQe5aymaCmkcSl9bnPL5ClLXcz2QA=_
IV: _ �6�k���_O�'�9~���d�~/C�yK�~�� _
这是代码
//Encryption/Decryption key
$Key = hash("SHA256", $Lname, true);
//Encryption Algorithm
$cipher_alg = MCRYPT_RIJNDAEL_256;
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg, MCRYPT_MODE_ECB), MCRYPT_RAND);
$ESSN = mcrypt_encrypt($cipher_alg, $Key, $SSN, MCRYPT_MODE_CBC, $iv);
$ESSN = '_' . base64_encode($ESSN) . '_';
$iv = '_' . $iv . '_';
if(!mysqli_query($connection, "CALL Update_ClientSSN('$ESSN','$iv', ' $AppID', '" . $_SESSION['ID'] . "' );")){
$Save .= " Error saving Client SSN";
echo $connection->error;
echo $ESSN . ' IV: ' . $iv;
}
同样最初我只是将IV和密文连接起来然后爆炸,但这仍然会引发错误,所以下划线只是我在试验。我很难过