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
lengthintThe length of the nonce.
Returns
- string
The generated nonce.
Remarks
Exceptions
- ArgumentException
Thrown if
lengthis <= 0.
Sha256Hash(string)
Hashes a string using SHA256 and returns it encoded as a HEX string.
public static string Sha256Hash(string content)
Parameters
contentstringThe content to hash.
Returns
- string
The hashed data as a HEX string.
Exceptions
- ArgumentException
Thrown if
contentis null or empty.