Pure.HashCodes 2.2.0

dotnet add package Pure.HashCodes --version 2.2.0
                    
NuGet\Install-Package Pure.HashCodes -Version 2.2.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="Pure.HashCodes" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pure.HashCodes" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Pure.HashCodes" />
                    
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 Pure.HashCodes --version 2.2.0
                    
#r "nuget: Pure.HashCodes, 2.2.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 Pure.HashCodes@2.2.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=Pure.HashCodes&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Pure.HashCodes&version=2.2.0
                    
Install as a Cake Tool

Pure.HashCodes

Deterministic hash code generation for the Pure ecosystem — stable, byte-enumerable hashes over immutable primitive types.

.NET build & test Benchmarks Build and Deploy NuGet License: MIT

Overview

Pure.HashCodes provides a single entry point — DeterminedHash — that produces a stable, ordered sequence of bytes for any value implementing a Pure.Primitives.Abstractions interface. Unlike object.GetHashCode(), the output is deterministic across processes and runtimes and can be combined from multiple fields into a single compound hash.

GetHashCode() and ToString() are intentionally unsupported on DeterminedHash and throw NotSupportedException — callers must consume the byte sequence directly.

API

DeterminedHash is a sealed record implementing IDeterminedHash : IEnumerable<byte>.

Constructors

Constructor Input type
DeterminedHash(IBool) Boolean value
DeterminedHash(IChar) Single character
DeterminedHash(IDate) Date (day / month / year)
DeterminedHash(ITime) Time (hour / minute / second / …)
DeterminedHash(IDateTime) Date + time composition
DeterminedHash(IDayOfWeek) Day of week
DeterminedHash(INumber<double>) 64-bit floating point
DeterminedHash(INumber<float>) 32-bit floating point
DeterminedHash(INumber<int>) Signed 32-bit integer
DeterminedHash(INumber<uint>) Unsigned 32-bit integer
DeterminedHash(INumber<ushort>) Unsigned 16-bit integer
DeterminedHash(IGuid) GUID value
DeterminedHash(IString) String value
DeterminedHash(IEnumerable<IDeterminedHash>) Aggregated compound hash
DeterminedHash(IEnumerable<byte>) Raw byte sequence

Design Principles

  • Deterministic — identical inputs always produce identical byte sequences, regardless of runtime or process lifetime.
  • Abstraction-driven — works exclusively with Pure.Primitives.Abstractions interfaces, not concrete types.
  • Composable — multiple DeterminedHash values can be aggregated into a single compound hash via IEnumerable<IDeterminedHash>.
  • AOT-compatible — the library is fully compatible with Native AOT compilation.

Dependencies

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10
  • .NET 11

Installation

dotnet add package Pure.HashCodes

Usage

Hash a single primitive:

using Pure.HashCodes;
using Pure.Primitives.Number;

INumber<int> id = new Int(42);
IEnumerable<byte> hashBytes = new DeterminedHash(id);

Combine multiple fields into a compound hash:

using Pure.HashCodes;
using Pure.HashCodes.Abstractions;

IDeterminedHash nameHash = new DeterminedHash(name);
IDeterminedHash dateHash = new DeterminedHash(birthDate);

IEnumerable<byte> compound = new DeterminedHash(new[] { nameHash, dateHash });
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on Pure.HashCodes:

Package Downloads
Pure.RelationalSchema.HashCodes

Package Description

Pure.Chart.Model.HashCodes

Package Description

Pure.Diagram.Model.HashCodes

Package Description

Pure.Chart.RichRelationalModel.HashCodes

Package Description

Pure.Chart.RelationalModel.HashCodes

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 452 11/11/2026
2.1.0 10,230 12/5/2025
2.0.0 1,372 11/1/2025
1.0.0 2,185 8/25/2025
0.4.0 1,302 6/23/2025
0.3.0 258 6/16/2025
0.2.0 219 6/8/2025
0.1.0 213 6/7/2025