Skip to main content

HashService Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.Hashing

HashService Class

Provides hashing functionality for various types of data, including but not limited to client secrets, in OAuth 2.0 and OpenID Connect authentication flows. This class supports SHA-256 and SHA-512 hashing algorithms to securely hash data.

public class HashService : Abblix.Oidc.Server.Features.Hashing.IHashService

Inheritance System.Object → HashService

Implements IHashService

Remarks

Hashing data, especially secrets, enhances privacy and security by ensuring that only a hashed version of the data is stored. In the event of a data breach, attackers cannot access the actual data, such as client secrets, thereby reducing the risk of exploitation.

Methods

HashService.Sha(HashAlgorithm, string) Method

Computes a hash for the provided data using the specified hash algorithm.

public byte[] Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm algorithm, string data);

Parameters

algorithm HashAlgorithm

The hash algorithm to use (e.g., SHA-256 or SHA-512).

data System.String

The data to hash.

Implements Sha(HashAlgorithm, string)

Returns

System.Byte[]
A byte array containing the hash of the data.

Exceptions

System.ArgumentOutOfRangeException
Thrown when the specified hash algorithm is not supported.