#### [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')

## IHashService Interface

Offers hashing functionality for data using various Secure Hash Algorithms \(SHA\)\.
This service is essential for securely storing and comparing sensitive information
like passwords or client secrets without exposing the actual values\.

```csharp
public interface IHashService
```

Derived  
↳ [HashService](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.Hashing.HashService 'Abblix\.Oidc\.Server\.Features\.Hashing\.HashService')
### Methods

## IHashService\.Sha\(HashAlgorithm, string\) Method {#Abblix.Oidc.Server.Features.Hashing.IHashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string)}

Generates a hash for the specified data using a chosen SHA algorithm\.
This method provides a way to securely hash sensitive data, such as secrets
or passwords, ensuring that the original data cannot be easily derived from the hash\.

```csharp
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.IHashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string).algorithm}

Specifies the SHA algorithm to use for hashing, such as 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.IHashService.Sha(Abblix.Oidc.Server.Features.Hashing.HashAlgorithm,string).data}

The data to hash\. Typically, this is sensitive information that needs secure handling\.

#### 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 input data\.

### Remarks
It is crucial to select an appropriate SHA algorithm based on security requirements and performance considerations\.
The hash output is ideal for verifying data integrity and authenticating users or clients without storing or transmitting
sensitive plain\-text data\.
