php aes加解密

2019-04-09  本文已影响0人  博楠同学

<?php/** * AES 的ECB 加解密 */

$a = [ 'company'=>'nsfocus', 'time'=>1518316334];
$a = http_build_query($a);
echo "<br>";
$encrypt = openssl_encrypt($a,'AES-128-ECB',"1234567812345678");
echo $encrypt;echo "<br>";
$encrypted = base64_decode($encrypt);//
$encrypted="Pq+ePEU0GTBKCFep5OIRXGYTNVZt8y7wR8S1t1nguCLzDGnE+UXmVOvUs4ixyPeQ";
echo openssl_decrypt($encrypted,'AES-128-ECB',"1234567812345678",OPENSSL_RAW_DATA); // 解密
上一篇下一篇

猜你喜欢

热点阅读