/**
* decrypt
*
* @
param string $input string to decrypted
* @
return string string decrypted
*/
public function decrypt($input)
{
$decrypted = openssl_decrypt(base64_decode($input), 'AES-128-CBC', $this->key, OPENSSL_RAW_DATA, $this->hexToStr($this->hex_iv));
return $decrypted;
}
/**
* hexToStr
*
* @
param string $hex hex
* @
return string string
*/
private function hexToStr($hex)
{
$string = '';
$len = strlen($hex);
for ($i = 0; $i < $len - 1; $i += 2) {
$string .= chr(hexdec($hex[$i] . $hex[$i + 1]));
}
return $string;
}