AES加密解密算法

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, '');
    }

}
相關文章
相關標籤/搜索