from typing import Dict
from typing import Tuple


def get_mismatched_hashes(
        actual: Dict[str, str], expected: Dict[str, str]
) -> Dict[str, Tuple[str, str]]:
    """
    Returns all the hashes that didn't match up.  The returned value is the
    hash algorithm name mapped to the tuple `(actual, expected)`.  Any actual
    hashes not in the expected list are ignored.  Any expected hashes not in
    the actual list are marked as an error, with the actual value set to an
    empty string.  If the expected value is an empty string, then the actual
    value is ignored, even if it doesn't exist.
    """
    ret: Dict[str, Tuple[str, str]] = {}
    for hash_name, expected_digest in expected.items():
        if not expected_digest:
            continue
        actual_digest = ''
        if hash_name in actual:
            actual_digest = actual[hash_name]
        if expected_digest != actual_digest:
            ret[hash_name] = (actual_digest, expected_digest,)
    return ret