private function encrypt(string $data): string
    {
        $cipher = Cryptography::encrypt($data, $this->cryptKey);
        list($initializationVector, $cipher) = explode(':', $cipher);
        $initializationVector = base64_decode($initializationVector);
        $cipher = base64_decode($cipher);
        $content = $initializationVector . Cryptography::getEncryptionAlgorithm() . $cipher;
        $hmac = hash_hmac('sha256', $content, $this->cryptAuth);
        return $hmac . ':' . base64_encode($initializationVector) . ':' . base64_encode($cipher);
    }
private function encrypt(string $data): string
    {
        $cipher = Cryptography::encrypt($data, $this->cryptKey);
        list($initializationVector, $cipher) = explode(':', $cipher);
        $initializationVector = base64_decode($initializationVector);
        $cipher = base64_decode($cipher);
        $content = $initializationVector . Cryptography::getEncryptionAlgorithm() . $cipher;
        $hmac = hash_hmac('sha256', $content, $this->cryptAuth);
        return $hmac . ':' . base64_encode($initializationVector) . ':' . base64_encode($cipher);
    }
private function encrypt ( string $ data ) : string { $ cipher = Cryptography :: encrypt ( $ data , $ this -> cryptKey ) ; list ( $ initializationVector , $ cipher ) = explode ( ':' , $ cipher ) ; $ initializationVector = base64_decode ( $ initializationVector ) ; $ cipher = base64_decode ( $ cipher ) ; $ content = $ initializationVector . Cryptography :: getEncryptionAlgorithm ( ) . $ cipher ; $ hmac = hash_hmac ( 'sha256' , $ content , $ this -> cryptAuth ) ; return $ hmac . ':' . base64_encode ( $ initializationVector ) . ':' . base64_encode ( $ cipher ) ; }
Encrypt the specified data using the defined algorithm. Also create an
Hmac authentication hash.

@param string $data
@return string
Encrypt the specified data using the defined algorithm . Also create an Hmac authentication hash .