Skip to content

Hashing Class ​

Definition ​

Provides helper methods for computing cryptographic hashes and HMACs over strings, byte arrays, and arbitrary objects.

  • Namespace: JASE
  • Assembly: JASE.dll

Methods ​

NameDescription
byte[] GetHash(byte[] input, HashProvider? provider = null, int loop = null)Computes a hash over the specified byte array using the requested provider.
byte[] GetHash(object input, HashProvider? provider = null, int loop = null)Computes a hash over the JSON-serialized representation of the specified object.
byte[] GetHash(string input, HashProvider? provider = null, int loop = null)Computes a hash over the specified string using the requested provider.
string GetHashAsString(byte[] input, HashProvider? provider = null, int loop = null)Computes a hash over the specified bytes and returns it as a hex string.
string GetHashAsString(object input, HashProvider? provider = null, int loop = null)Computes a hash over the JSON-serialized representation of the specified object and returns it as a hex string.
string GetHashAsString(string input, HashProvider? provider = null, int loop = null)Computes a hash over the specified string and returns it as a hex string.
byte[] GetHmacHash(byte[] input, byte[] key, HmacImplementation? hmac = null)Computes an HMAC over the given bytes using the requested HMAC algorithm and key bytes.
byte[] GetHmacHash(byte[] input, string key, HmacImplementation? hmac = null, Encoding encoding = null)Computes an HMAC over the given bytes using the requested HMAC algorithm and key string.
byte[] GetHmacHash(string input, string key, HmacImplementation? hmac = null, Encoding encoding = null)Computes an HMAC over the given string using the requested HMAC algorithm and key.
string HashToString(byte[] input)Converts the hash bytes to a hex string representation.
bool SetDefaultSalt(int[] input, int increment = null)Sets the default salt sequence from an existing encoded salt array.
bool SetDefaultSalt(string input, int increment = null)Derives and sets the default salt sequence from the specified input string.

Remarks ​

Hashing algorithms are selected via HashProvider and are created per-call. MD5 and SHA-1 are available for legacy scenarios but should not be used for new security-sensitive code.