import hashlib


def hash_block(block_hex):
    """
    Generates the hash for the given block bytes.
    This hash is required in combination with the signing fields, prior to the signature.

    :param block_hex:
        Hexadecimal string containing the preamble, account, frontier block, representative, balance and link.
    """
    block_hex_bytes = bytes.fromhex(block_hex)
    block_hash = hashlib.blake2b(block_hex_bytes, digest_size=32).hexdigest().upper()
    return block_hash