Class HexString
A codec for Hexadecimal.
Inherited Members
Namespace: Ipfs
Assembly: Ipfs.Core.dll
Syntax
public static class HexString
Remarks
A codec for a hexadecimal string, Encode(Byte[], String) and Decode(String). Adds the extension method ToHexString(Byte[], String) to encode a byte array and ToHexBuffer(String) to decode a hexadecimal String.
Methods
| Improve this Doc View SourceDecode(String)
Converts the specified String, which encodes binary data as hexadecimal digits, to an equivalent 8-bit unsigned integer array.
Declaration
public static byte[] Decode(string s)
Parameters
Type | Name | Description |
---|---|---|
String | s | The hexadecimal string to convert. |
Returns
Type | Description |
---|---|
Byte[] | An array of 8-bit unsigned integers that is equivalent to |
Encode(Byte[], String)
Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.
Declaration
public static string Encode(byte[] buffer, string format = "G")
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | An array of Byte. |
String | format | One of the format specifiers ("G" and "x" for lower-case hex digits, or "X" for the upper-case). The default is "G". |
Returns
Type | Description |
---|---|
String | The string representation, in hexadecimal, of the contents of |
ToHexBuffer(String)
Converts the specified String, which encodes binary data as a hexadecimal string, to an equivalent 8-bit unsigned integer array.
Declaration
public static byte[] ToHexBuffer(this string s)
Parameters
Type | Name | Description |
---|---|---|
String | s | The hexadecimal string to convert. |
Returns
Type | Description |
---|---|
Byte[] | An array of 8-bit unsigned integers that is equivalent to |
ToHexString(Byte[], String)
Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.
Declaration
public static string ToHexString(this byte[] buffer, string format = "G")
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | An array of Byte. |
String | format | One of the format specifiers ("G" and "x" for lower-case hex digits, or "X" for the upper-case). The default is "G". |
Returns
Type | Description |
---|---|
String | The string representation, in hexadecimal, of the contents of |