// php 这样操作也不对
var_dump(openssl_decrypt('8BC40C1D6A5DCEE56CB61B564400D5DB0A63B5F8AFA918338DA3234ED5CA328AA3D53D12BE8E9579BADFA05CC9AE36D2','AES-128-ECB','217BB3C10B1C3393',0,'0000000000000000'));
/**
* @desc:php aes加密解密类
* @author gl
* @date 2019/08/31
*/
class CI_Aes{
/**
* CI_Aes cipher
* @var string
*/
protected $cipher = 'aes-128-ecb';
/**
* CI_Aes key
*
* @var string
*/
protected $key;
/**
* CI_Aes constructor
* @param string $key Configuration parameter
*/
public function __construct($key=null){
$this->key = $key;
}
/**
* Initialize
*
* @param array $params Configuration parameters
* @return CI_Encryption
*/
public function initialize($params)
{
if (!empty($params) && is_array($params)) {
foreach ($params as $key => $val) {
$this->$key = $val;
}
}
}
/**
* Encrypt
*
* @param string $data Input data
* @return string
*/
public function encrypt($data) {
$endata = openssl_encrypt($data, $this->cipher, $this->key, OPENSSL_RAW_DATA);
return bin2hex($endata);
}
/**
* Decrypt
*
* @param string $data Encrypted data
* @return string
*/
public function decrypt($data) {
$encrypted = hex2bin($data);
return openssl_decrypt($encrypted, $this->cipher, $this->key, OPENSSL_RAW_DATA);
}
}
这里有个解密的类,应该能给你点思路@大尨,