Class EncodingUtils
Helper methods for encoding strings, decoding byte arrays, calculating hashes, etc..
public static class EncodingUtils
- Inheritance
-
objectEncodingUtils
Fields
Utf8
UTF-8 encoding without BOM (byte order marker).
public static readonly Encoding Utf8
Field Value
- Encoding
Methods
Base16Decode(string)
Decodes a base16 (hexadecimal) to a byte array.
[Pure]
public static byte[] Base16Decode(this string encoded)
Parameters
encoded
string
Returns
- byte[]
Base16Encode(byte[])
Encodes a byte array in base16 (hexadecimal).
[Pure]
public static string Base16Encode(this byte[] data)
Parameters
data
byte[]
Returns
- string
Base32Encode(byte[])
Encodes a byte array in base32 without padding.
[Pure]
public static string Base32Encode(this byte[] data)
Parameters
data
byte[]
Returns
- string
Base64Utf8Decode(string)
Decodes a UTF-8 in base64 string.
[Pure]
public static string Base64Utf8Decode(this string value)
Parameters
value
string
Returns
- string
Exceptions
- FormatException
value
is not a valid base 64 string.
Base64Utf8Encode(string)
Encodes a string as UTF-8 in base64.
[Pure]
public static string Base64Utf8Encode(this string value)
Parameters
value
string
Returns
- string
Hash(string, HashAlgorithm)
Computes the hash value of a string encoded as UTF-8.
[Pure]
public static string Hash(this string value, HashAlgorithm algorithm)
Parameters
value
stringThe string to hash.
algorithm
HashAlgorithmThe hashing algorithm to use.
Returns
- string
A hexadecimal string representation of the hash value.