Table of Contents

Class HashUtils

Namespace
Uralstech.UMoth

Utilities for cryptographically secure hashing.

public static class HashUtils
Inheritance
object
HashUtils

Methods

RandomNonceString(int)

Generates a cryptographically secure nonce of length length.

public static string RandomNonceString(int length = 32)

Parameters

length int

The length of the nonce.

Returns

string

The generated nonce.

Remarks

Loosely based on this Firebase example:

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 string

The content to hash.

Returns

string

The hashed data as a HEX string.

Exceptions

ArgumentException

Thrown if content is null or empty.