public function decrypt($data)
	{
		if (!$this->encEnabled) return $data; // no encryption
		switch ($this->encMethod) {
			case 'SIMPLE':
				return $this->decryptSimple($data);
			case 'INTEGER':
				return $this->decryptInteger($data);
		}
		$data=base64_decode(str_replace(array('-', '_'),array('+', '/'),$data));
		$iv_strlen = 2 * openssl_cipher_iv_length($this->encMethod);
		if (preg_match("/^(.{" . $iv_strlen . "})(.+)$/", $data, $regs)) {
			try {
				list(, $iv, $crypted_string) = $regs;
				$decrypted_string = openssl_decrypt($crypted_string, $this->encMethod, $this->encPassword, 0, hex2bin($iv));
				return substr($decrypted_string, strlen($this->encSalt));
			} catch(Exception $ex) {
				return false;
			}
		} else {
			return false;
		}
	}
public function decrypt($data)
	{
		if (!$this->encEnabled) return $data; // no encryption
		switch ($this->encMethod) {
			case 'SIMPLE':
				return $this->decryptSimple($data);
			case 'INTEGER':
				return $this->decryptInteger($data);
		}
		$data=base64_decode(str_replace(array('-', '_'),array('+', '/'),$data));
		$iv_strlen = 2 * openssl_cipher_iv_length($this->encMethod);
		if (preg_match("/^(.{" . $iv_strlen . "})(.+)$/", $data, $regs)) {
			try {
				list(, $iv, $crypted_string) = $regs;
				$decrypted_string = openssl_decrypt($crypted_string, $this->encMethod, $this->encPassword, 0, hex2bin($iv));
				return substr($decrypted_string, strlen($this->encSalt));
			} catch(Exception $ex) {
				return false;
			}
		} else {
			return false;
		}
	}
public function decrypt ( $ data ) { if ( ! $ this -> encEnabled ) return $ data ; // no encryption switch ( $ this -> encMethod ) { case 'SIMPLE' : return $ this -> decryptSimple ( $ data ) ; case 'INTEGER' : return $ this -> decryptInteger ( $ data ) ; } $ data = base64_decode ( str_replace ( array ( '-' , '_' ) , array ( '+' , '/' ) , $ data ) ) ; $ iv_strlen = 2 * openssl_cipher_iv_length ( $ this -> encMethod ) ; if ( preg_match ( "/^(.{" . $ iv_strlen . "})(.+)$/" , $ data , $ regs ) ) { try { list ( , $ iv , $ crypted_string ) = $ regs ; $ decrypted_string = openssl_decrypt ( $ crypted_string , $ this -> encMethod , $ this -> encPassword , 0 , hex2bin ( $ iv ) ) ; return substr ( $ decrypted_string , strlen ( $ this -> encSalt ) ) ; } catch ( Exception $ ex ) { return false ; } } else { return false ; } }
It is a two way decryption
@param $data
@return bool|string
It is a two way decryption