Class MultiBaseAlgorithm
Metadata and implemetations of an IPFS multi-base algorithm.
Inherited Members
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 SourceAll
A sequence consisting of all algorithms.
Declaration
public static IEnumerable<MultiBaseAlgorithm> All { get; }
Property Value
Type | Description |
---|---|
IEnumerable<MultiBaseAlgorithm> |
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. |
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[]> |
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> |
Name
The name of the algorithm.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
String | A unique name. |
Methods
| Improve this Doc View SourceDeregister(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. |
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<String, Byte[]> | decode | A |
Returns
Type | Description |
---|---|
MultiBaseAlgorithm | A new MultiBaseAlgorithm. |
ToString()
The Name of the algorithm.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |