Table of Contents

Class Hash

Namespace
Ubiety.Scram.Core
Assembly
Ubiety.Scram.Core.dll

Represents a utility class for cryptographic hashing operations using SHA-1, SHA-256, or SHA-512. Provides methods to compute hashes for byte arrays with optional key-based hashing or iterative hashing for password-based systems.

public class Hash
Inheritance
Hash
Inherited Members

Methods

ComputeHash(byte[])

Computes the hash of the provided byte array using the configured hash algorithm.

public byte[] ComputeHash(byte[] value)

Parameters

value byte[]

The byte array to compute the hash for.

Returns

byte[]

A byte array representing the computed hash.

ComputeHash(byte[], byte[])

Computes the hash of the specified data using the given key.

public byte[] ComputeHash(byte[] value, byte[] key)

Parameters

value byte[]

The data to be hashed.

key byte[]

The key used for hashing.

Returns

byte[]

A byte array containing the computed hash.

ComputeHash(byte[], IEnumerable<byte>, int)

Computes a cryptographic hash using the provided password, salt, and iterations.

public byte[] ComputeHash(byte[] password, IEnumerable<byte> salt, int iterations)

Parameters

password byte[]

The byte array representing the password to hash.

salt IEnumerable<byte>

The byte array used as the salt for the hash.

iterations int

The number of iterations to perform on the hash.

Returns

byte[]

A byte array containing the computed hash value.

Exceptions

ArgumentOutOfRangeException

Thrown when iterations is less than one.

Sha1()

Gets a new SHA1 hash.

public static Hash Sha1()

Returns

Hash

Hash set to use SHA1.

Sha256()

Gets a new SHA256 hash.

public static Hash Sha256()

Returns

Hash

Hash set to use SHA256.

Sha512()

Gets a new SHA512 hash.

public static Hash Sha512()

Returns

Hash

Hash set to use SHA512.