def _CID_validate_multihash_digest(digest: Union[(str, BytesLike)]) -> Tuple[(Multihash, bytes)]:
    if isinstance(digest, str):
        digest = bytes.fromhex(digest)
    raw_digest: BytesLike
    (code, raw_digest) = multihash.unwrap_raw(digest)
    hashfun = _CID_validate_multihash(code)
    raw_digest = _CID_validate_raw_digest(raw_digest, hashfun)
    return (hashfun, raw_digest)
def _CID_validate_multihash_digest(digest: Union[(str, BytesLike)]) -> Tuple[(Multihash, bytes)]:
    if isinstance(digest, str):
        digest = bytes.fromhex(digest)
    raw_digest: BytesLike
    (code, raw_digest) = multihash.unwrap_raw(digest)
    hashfun = _CID_validate_multihash(code)
    raw_digest = _CID_validate_raw_digest(raw_digest, hashfun)
    return (hashfun, raw_digest)