import hashlib


def md5_file(file_path: str) -> str:
    """Generate the MD5 of a file.

    :param file_path: The file to generate the MD5 for

    :returns: The MD5 as a hex string
    """
    hasher = hashlib.md5()
    with open(file_path, "rb") as file_handle:
        for chunk in iter(lambda: file_handle.read(4096), b""):
            hasher.update(chunk)
    return hasher.hexdigest()