private function decrypt(string $data): string
    {
        list($hmac, $initializationVector, $cipher) = explode(':', $data);
        $ivReal = base64_decode($initializationVector);
        $cipherReal = base64_decode($cipher);
        $validHash = $ivReal . Cryptography::getEncryptionAlgorithm() . $cipherReal;
        $newHmac = hash_hmac('sha256', $validHash, $this->cryptAuth);
        if ($hmac !== $newHmac) {
            throw new \RuntimeException("Invalid decryption key");
        }
        $decrypt = Cryptography::decrypt($initializationVector . ':' . $cipher, $this->cryptKey);
        return $decrypt;
    }
private function decrypt(string $data): string
    {
        list($hmac, $initializationVector, $cipher) = explode(':', $data);
        $ivReal = base64_decode($initializationVector);
        $cipherReal = base64_decode($cipher);
        $validHash = $ivReal . Cryptography::getEncryptionAlgorithm() . $cipherReal;
        $newHmac = hash_hmac('sha256', $validHash, $this->cryptAuth);
        if ($hmac !== $newHmac) {
            throw new \RuntimeException("Invalid decryption key");
        }
        $decrypt = Cryptography::decrypt($initializationVector . ':' . $cipher, $this->cryptKey);
        return $decrypt;
    }
private function decrypt ( string $ data ) : string { list ( $ hmac , $ initializationVector , $ cipher ) = explode ( ':' , $ data ) ; $ ivReal = base64_decode ( $ initializationVector ) ; $ cipherReal = base64_decode ( $ cipher ) ; $ validHash = $ ivReal . Cryptography :: getEncryptionAlgorithm ( ) . $ cipherReal ; $ newHmac = hash_hmac ( 'sha256' , $ validHash , $ this -> cryptAuth ) ; if ( $ hmac !== $ newHmac ) { throw new \ RuntimeException ( "Invalid decryption key" ) ; } $ decrypt = Cryptography :: decrypt ( $ initializationVector . ':' . $ cipher , $ this -> cryptKey ) ; return $ decrypt ; }
Decrypt the specified data using the defined algorithm. Also verify the
Hmac authentication hash. Returns false if Hmac validation fails.

@param string $data
@throws \Exception
@return string
Decrypt the specified data using the defined algorithm . Also verify the Hmac authentication hash . Returns false if Hmac validation fails .