import hmac
import hashlib


def generate_hmac_hash(key: str, data: str) -> str:
    """
    Accept key and data in any format and encodes it into bytes.

    :param key: HMAC hash key
    :type key: str
    :param data: content to be hashed separated by '|'
    :type data: str
    :return: cryptographic hash of data combined with key
    :rtype: str
    """
    encoded_key = bytes(key, 'latin-1')
    encoded_data = bytes(data, 'latin-1')
    return hmac.new(encoded_key, encoded_data, hashlib.sha256).hexdigest()