#### [Abblix\.Oidc\.Server](https://www.abblix.com/en/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Features\.Hashing](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Hashing '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\.

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

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → HashService

Implements [IHashService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Hashing.IHashService 'Abblix\.Oidc\.Server\.Features\.Hashing\.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 {#Abblix.Oidc.Server.Features.Hashing.HashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string)}

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

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

###### `algorithm` [HashAlgorithm](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Hashing.HashAlgorithm 'Abblix\.Oidc\.Server\.Features\.Hashing\.HashAlgorithm') {#Abblix.Oidc.Server.Features.Hashing.HashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string).algorithm}

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

###### `data` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.Hashing.HashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string).data}

The data to hash\.

Implements [Sha\(HashAlgorithm, string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Hashing.IHashService#Abblix.Oidc.Server.Features.Hashing.IHashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string) 'Abblix\.Oidc\.Server\.Features\.Hashing\.IHashService\.Sha\(Abblix\.Oidc\.Server\.Features\.Hashing\.HashAlgorithm, string\)')

#### Returns
[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')  
A byte array containing the hash of the data\.

#### Exceptions

[System\.ArgumentOutOfRangeException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception 'System\.ArgumentOutOfRangeException')  
Thrown when the specified hash algorithm is not supported\.
