Class HexEncoding
- Namespace
- LibSodium
- Assembly
- LibSodium.Net.dll
Provides methods for encoding and decoding hexadecimal strings and byte buffers.
public static class HexEncoding
- Inheritance
-
HexEncoding
- Inherited Members
Methods
BinToHex(ReadOnlySpan<byte>)
Converts a byte buffer to a hexadecimal string in constant time for a given size.
public static string BinToHex(ReadOnlySpan<byte> bin)
Parameters
bin
ReadOnlySpan<byte>The byte buffer to convert.
Returns
- string
A hexadecimal string representation of the byte buffer.
BinToHex(ReadOnlySpan<byte>, Span<char>)
Converts a byte buffer to a hexadecimal string using a provided character span.
public static Span<char> BinToHex(ReadOnlySpan<byte> bin, Span<char> hex)
Parameters
bin
ReadOnlySpan<byte>The byte buffer to convert.
hex
Span<char>The span to write the hexadecimal string into.
Returns
HexToBin(ReadOnlySpan<char>, Span<byte>, string?)
Converts a span of characters representing a hexadecimal string to a byte buffer.
public static Span<byte> HexToBin(ReadOnlySpan<char> hex, Span<byte> bin, string? ignore = null)
Parameters
hex
ReadOnlySpan<char>The span of characters representing the hexadecimal string.
bin
Span<byte>The span to write the byte buffer into.
ignore
stringOptional characters to ignore during conversion.
Returns
HexToBin(string, Span<byte>, string?)
Converts a hexadecimal string to a byte buffer.
public static Span<byte> HexToBin(string hex, Span<byte> bin, string? ignore = null)
Parameters
hex
stringThe hexadecimal string to convert.
bin
Span<byte>The span to write the byte buffer into.
ignore
stringOptional characters to ignore during conversion.