AES/ECB/PKCS5Padding加密
error_reporting(E_ALL^E_NOTICE^E_WARNING);//此句要加上,否则会报php错误当iv位空时
class encrypt_parm {
private $iv = "";//密钥偏移量IV
private $encryptKey = "wina012300000000";//AESkey
//加密
public function encrypt($encryptStr) {
$localIV = $this->iv;
$encryptKey = $this->encryptKey;
//Open module
$module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, $localIV);
//print "module = $module
" ;
mcrypt_generic_init($module, $encryptKey, $localIV);
//Padding
$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$pad = $block - (strlen($encryptStr) % $block); //Compute how many characters need to pad
$encryptStr .= str_repeat(chr($pad), $pad); // After pad, the str length must be eq