Zhomfr.Hash.Abstractions 0.7.0

dotnet add package Zhomfr.Hash.Abstractions --version 0.7.0
                    
NuGet\Install-Package Zhomfr.Hash.Abstractions -Version 0.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zhomfr.Hash.Abstractions" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zhomfr.Hash.Abstractions" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Zhomfr.Hash.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Zhomfr.Hash.Abstractions --version 0.7.0
                    
#r "nuget: Zhomfr.Hash.Abstractions, 0.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Zhomfr.Hash.Abstractions@0.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Zhomfr.Hash.Abstractions&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Zhomfr.Hash.Abstractions&version=0.7.0
                    
Install as a Cake Tool

Abstractions for Unified Work with Hashes.

NuGet Status NuGet Downloads

⚠️ Warning: Active Development (< 1.0.0)

Prior to the release of stable version 1.0.0, this library follows SemVer for initial development. This means breaking changes may occur even in minor releases (0.x).

We strongly recommend pinning the package version in your .csproj to avoid unexpected build errors.

A lightweight and flexible .NET library providing a unified contract for hash functions. It completely decouples your business logic from specific hashing algorithms or third-party implementations.

💡 Core Concept

Your code interacts exclusively with a standardized interface. The underlying algorithm is determined at the dependency injection composition root. If you ever need to change the algorithm or provider tomorrow, you won't need to rewrite your business logic.

Available Drivers:

Development Custom Driver

📦 Installation

Install package:

dotnet add package Zhomfr.Hash.Abstractions

For example, you can use code of available drivers in GitHub.

Configuration Convention

All settings are located in appsettings.json under the Zhomfr:Hash section:

  • The default service uses the Zhomfr:Hash:Default subsection.
  • Keyed services use subsections where the name matches the service key, resulting in Zhomfr:Hash:KeyName.

For instance, given the following registrations:

builder.Services.AddDefaultHash<MyAwesomeHash, MyAwesomeHashConfig>();
builder.Services.AddKeyedHash<MyAwesomeHash, MyAwesomeHashConfig>("AwesomeKey");

Your appsettings.json file should follow this structure:

{
  "Zhomfr": {
    "Hash": {
      "Default": {
        "Secret": "someSecretForDefault"
        // ... other configuration properties
      },
      "AwesomeKey": {
        "Secret": "someSecretForAwesomeKey"
        // ... other configuration properties
      }
    }
  }
}

IHash

Namespace: Zhomfr.Hash.Abstractions

Defines methods for secure password hashing and verification.

public interface IHash

Attributes NullableContextAttribute

Methods

Make (String)

Creates a secure hash for the specified password.

string Make(string password)
Parameters

password String<br> The plain-text password to be hashed.

Returns

String<br> A string containing the hash along with metadata (version, salt, and algorithm parameters) for subsequent storage in a database.

Check (String, String)

Verifies that the provided password matches the stored hash.

bool Check(string password, string storedHash)
Parameters

password String<br> The plain-text password to verify.

storedHash String<br> The full hash string previously generated via the IHash.Make (String) method.

Returns

Boolean<br> True if the password is correct; otherwise, false.

Remarks:

The implementation should use fixed-time comparison to prevent side-channel timing attacks.

NeedsRehash (String)

Determines if the password hash needs to be updated due to changes in security settings.

bool NeedsRehash(string storedHash)
Parameters

storedHash String<br> The current hash from the data store.

Returns

Boolean<br> True if the system's algorithm parameters (e.g., MemorySize or Iterations) differ from those embedded in the hash.

Remarks:

If this method returns true, it is recommended to re-create the hash using IHash.Make (String) during the user's next successful authentication.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Zhomfr.Hash.Abstractions:

Package Downloads
Zhomfr.Hash.Argon2

This library provides an Argon2 implementation of the `Zhomfr.Hash.Abstractions` hashing contract.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 36 10/26/2026
0.6.0 59 10/24/2026