Class HashUtils
Utilities for cryptographically secure hashing.
public static class HashUtils
- Inheritance
-
objectHashUtils
Methods
RandomNonceString(int)
Generates a cryptographically secure nonce of length length
.
public static string RandomNonceString(int length = 32)
Parameters
length
intThe length of the nonce.
Returns
- string
The generated nonce.
Remarks
Exceptions
- ArgumentException
Thrown if
length
is <= 0.
Sha256Hash(string)
Hashes a string using SHA256 and returns it encoded as a HEX string.
public static string Sha256Hash(string content)
Parameters
content
stringThe content to hash.
Returns
- string
The hashed data as a HEX string.
Exceptions
- ArgumentException
Thrown if
content
is null or empty.