import hashlib


def hash_file(path, hash_type):
    """create hash string for a file

    Arguments:
        path (str) : the path for the file
        hash_type (str) : the type of the hash

    Returns:
        list of byte : the hash bytes
    """
    with open(path, "rb") as f:
        h = hashlib.new(hash_type)
        while True:
            data = f.read(2 ** 20)
            if not data:
                break
            h.update(data)
        return h