欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

php aes加解密

程序员文章站 2024-03-14 17:27:34
...

<?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); // 解密

转载于:https://www.jianshu.com/p/4bd4ec957626