AES加密解密算法

时间:2023-12-28 16:07:44
class Aes
{ /**
* AES加密
* @param $data
* @param $secret_key
* @return string
*/
public static function encode($data, $secret_key) {
return openssl_encrypt($data, 'AES-128-ECB', $secret_key, 0, '');
} /**
* AES解密
* @param $data
* @param $secret_key
* @return string
*/
public static function decode($data, $secret_key) {
return openssl_decrypt($data, 'AES-128-ECB', $secret_key, 0, '');
} }