def METHOD_NAME(hexdigest):
    """Gets name of the hash algorithm for a hex digest."""
    bytes = len(hexdigest) / 2
    if bytes not in _size_to_hash:
        raise ValueError("Spack knows no hash algorithm for this digest: %s" % hexdigest)
    return _size_to_hash[bytes]