C# Class Ipfs.HexString

A codec for Hexadecimal.

A codec for a hexadecimal string, Encode and Decode. Adds the extension method ToHexString to encode a byte array and ToHexBuffer to decode a hexadecimal string.

显示文件 Open project: richardschneider/net-ipfs-core Class Usage Examples

Public Methods

Method Description
Decode ( string s ) : byte[]

Converts the specified string, which encodes binary data as hexadecimal digits, to an equivalent 8-bit unsigned integer array.

Encode ( byte buffer, string format = "G" ) : string

Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.

ToHexBuffer ( this s ) : byte[]

Converts the specified string, which encodes binary data as a hexadecimal string, to an equivalent 8-bit unsigned integer array.

ToHexString ( this buffer, string format = "G" ) : string

Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.

Method Details

Decode() public static method

Converts the specified string, which encodes binary data as hexadecimal digits, to an equivalent 8-bit unsigned integer array.
public static Decode ( string s ) : byte[]
s string /// The hexadecimal string to convert. ///
return byte[]

Encode() public static method

Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.
public static Encode ( byte buffer, string format = "G" ) : string
buffer byte /// An array of 8-bit unsigned integers. ///
format string /// One of the format specifiers ("G" and "x" for lower-case hex digits, or "X" for the upper-case). /// The default is "G". ///
return string

ToHexBuffer() public static method

Converts the specified string, which encodes binary data as a hexadecimal string, to an equivalent 8-bit unsigned integer array.
public static ToHexBuffer ( this s ) : byte[]
s this /// The hexadecimal string to convert. ///
return byte[]

ToHexString() public static method

Converts an array of 8-bit unsigned integers to its equivalent hexadecimal string representation.
public static ToHexString ( this buffer, string format = "G" ) : string
buffer this /// An array of 8-bit unsigned integers. ///
format string /// One of the format specifiers ("G" and "x" for lower-case hex digits, or "X" for the upper-case). /// The default is "G". ///
return string