Show / Hide Table of Contents

Class MultiBaseAlgorithm

Metadata and implemetations of an IPFS multi-base algorithm.

Inheritance
Object
MultiBaseAlgorithm
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: Ipfs.Registry
Assembly: Ipfs.Core.dll
Syntax
public class MultiBaseAlgorithm
Remarks

IPFS assigns a unique Name and Code to multi-base algorithm. See https://github.com/multiformats/multibase/blob/master/multibase.csv for the currently defined multi-base algorithms.

These algorithms are supported: base58btc, base58flickr, base64, base64pad, base64url, base16, base32, base32z, base32pad, base32hex and base32hexpad.

Properties

| Improve this Doc View Source

All

A sequence consisting of all algorithms.

Declaration
public static IEnumerable<MultiBaseAlgorithm> All { get; }
Property Value
Type Description
IEnumerable<MultiBaseAlgorithm>
| Improve this Doc View Source

Code

The IPFS code assigned to the algorithm.

Declaration
public char Code { get; }
Property Value
Type Description
Char

Valid codes at https://github.com/multiformats/multibase/blob/master/multibase.csv.

| Improve this Doc View Source

Decode

Returns a function that can return a byte array from a string.

Declaration
public Func<string, byte[]> Decode { get; }
Property Value
Type Description
Func<String, Byte[]>
| Improve this Doc View Source

Encode

Returns a function that can return a string from a byte array.

Declaration
public Func<byte[], string> Encode { get; }
Property Value
Type Description
Func<Byte[], String>
| Improve this Doc View Source

Name

The name of the algorithm.

Declaration
public string Name { get; }
Property Value
Type Description
String

A unique name.

Methods

| Improve this Doc View Source

Deregister(MultiBaseAlgorithm)

Remove an IPFS algorithm from the registry.

Declaration
public static void Deregister(MultiBaseAlgorithm algorithm)
Parameters
Type Name Description
MultiBaseAlgorithm algorithm

The MultiBaseAlgorithm to remove.

| Improve this Doc View Source

Register(String, Char, Func<Byte[], String>, Func<String, Byte[]>)

Register a new IPFS algorithm.

Declaration
public static MultiBaseAlgorithm Register(string name, char code, Func<byte[], string> encode = null, Func<string, byte[]> decode = null)
Parameters
Type Name Description
String name

The name of the algorithm.

Char code

The IPFS code assigned to thealgorithm.

Func<Byte[], String> encode

A Func to encode a byte array. If not specified, then a Func is created to throw a NotImplementedException.

Func<String, Byte[]> decode

A Func to decode a string. If not specified, then a Func is created to throw a NotImplementedException.

Returns
Type Description
MultiBaseAlgorithm

A new MultiBaseAlgorithm.

| Improve this Doc View Source

ToString()

The Name of the algorithm.

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()
  • Improve this Doc
  • View Source
Back to top Generated by DocFX