Class EncodingUtils
Helper methods for encoding strings, decoding byte arrays, calculating hashes, etc..
Inheritance
EncodingUtils
Assembly: NanoByte.Common.dll
Syntax
public static class EncodingUtils : Object
Fields
Utf8
UTF-8 encoding without BOM (byte order marker).
Declaration
public static readonly Encoding Utf8
Field Value
Methods
Base16Decode(String)
Decodes a base16 (hexadecimal) to a byte array.
Declaration
public static byte[] Base16Decode(this string encoded)
Parameters
Type |
Name |
Description |
String |
encoded |
|
Returns
Base16Encode(Byte[])
Encodes a byte array in base16 (hexadecimal).
Declaration
public static string Base16Encode(this byte[] data)
Parameters
Type |
Name |
Description |
Byte[] |
data |
|
Returns
Base32Encode(Byte[])
Encodes a byte array in base32 without padding.
Declaration
public static string Base32Encode(this byte[] data)
Parameters
Type |
Name |
Description |
Byte[] |
data |
|
Returns
Base64Utf8Decode(String)
Decodes a UTF-8 in base64 string.
Declaration
public static string Base64Utf8Decode(this string value)
Parameters
Type |
Name |
Description |
String |
value |
|
Returns
Exceptions
Base64Utf8Encode(String)
Encodes a string as UTF-8 in base64.
Declaration
public static string Base64Utf8Encode(this string value)
Parameters
Type |
Name |
Description |
String |
value |
|
Returns
Hash(String, HashAlgorithm)
Computes the hash value of a string encoded as UTF-8.
Declaration
public static string Hash(this string value, HashAlgorithm algorithm)
Parameters
Type |
Name |
Description |
String |
value |
The string to hash.
|
HashAlgorithm |
algorithm |
The hashing algorithm to use.
|
Returns
Type |
Description |
String |
A hexadecimal string representation of the hash value.
|