def compare_digests(digests1, digests2):
    """
    Compares two dictionaries of digests, as produced by `digest_files`.

    Args:
        digests1: First dictionary of digests.
        digests2: Second dictionary of digests.

    Return:
        A sorted list of all the files with different digests.
    """
    differences = []
    all_keys = set().union(digests1.keys(), digests2.keys())
    for key in all_keys:
        if digests1.get(key) != digests2.get(key):
            differences.append(key)
    differences.sort()
    return differences