func Encode(encoding string, hash mh.Multihash) (string, error) { switch encoding { case "raw": return string(hash), nil case "hex": return hex.EncodeToString(hash), nil case "base58": return base58.Encode(hash), nil case "base64": return base64.StdEncoding.EncodeToString(hash), nil default: return "", fmt.Errorf("unknown encoding: %s", encoding) } }
func (m Multihash) B58String() string { return b58.Encode([]byte(m)) }