code: func decodeObjectRef(iid string) (*api.ObjectRef, error) {
  	// Skip obviously wrong instance IDs faster and with a cleaner error message.
  	// We assume we use at least 160 bit digests here (which translates to at
  	// least 28 bytes of encoded iid).
  	if len(iid) < 28 {
  		return nil, fmt.Errorf("not a valid size for an encoded digest")
  	}
  
  	blob, err := base64.RawURLEncoding.DecodeString(iid)
  	switch {
  	case err != nil:
  		return nil, fmt.Errorf("cannot base64 decode - %s", err)
  	case len(blob) == 0:
  		return nil, fmt.Errorf("empty")
  	case len(blob)%2 != 1: // 1 byte for hashAlgo, the rest is the digest
  		return nil, fmt.Errorf("the digest can't be odd")
  	}
  
  	hashAlgo := api.HashAlgo(blob[len(blob)-1])
  	digest := blob[:len(blob)-1]
  
  	if hashAlgo == 0 {
  		return nil, fmt.Errorf("unspecified hash algo (0)")
  	}
  
  	// If algo is known to us, make sure it is valid. Otherwise just decode what
  	// we've given, assuming the caller will later verify the hash using
  	// ValidateHashAlgo, if really needed.
  	if int(hashAlgo) < len(supportedAlgos) {
  		if prop := supportedAlgos[hashAlgo]; len(digest)*2 != prop.hexDigestLen {
  			return nil, fmt.Errorf("wrong digest len %d for algo %s", len(digest), hashAlgo)
  		}
  	}
  
  	return &api.ObjectRef{
  		HashAlgo:  hashAlgo,
  		HexDigest: hex.EncodeToString(digest),
  	}, nil
  }
docs: // decodeObjectRef is a reverse of encodeObjectRef.