标签:
JS加密代码如下
var data = "mysql_connect(‘111.111.111.111‘,‘root‘,‘111111‘)";
var key = CryptoJS.enc.Latin1.parse(‘1111111111111111‘);
var iv = CryptoJS.enc.Latin1.parse(‘1111111111111111‘);
var encrypted = CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.ZeroPadding });
document.write(encrypted);
PHP的解密代码如下
$privateKey = "1111111111111111";
$iv = "1111111111111111";
$encryptedData = base64_decode("JLbb3T6NekoYFIcLeRZ45g7uiP3ojMdgSSUk3VKZgSvWVcCqqr/GaIv0mQ/hMvht 5YCM87tC3c9t05izRtsbZg==");
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $privateKey, $encryptedData, MCRYPT_MODE_CBC, $iv);
echo($decrypted);
?>
个人学习留存
标签: