CloudMesh.MurmurHash 2.0.108

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

CloudMesh.MurmurHash

Fast, well-distributed MurmurHash implementations for .NET — 32-bit, 64-bit, and 128-bit variants for hashing strings, byte buffers, arrays, and sets.

MurmurHash is a non-cryptographic hash designed for speed and good distribution: ideal for sharding, hash tables, bloom filters, consistent hashing, and deterministic bucketing. Unlike string.GetHashCode(), these produce stable values across processes and runs, so you can persist or compare them.

  • Targets: .NET 8, 9, 10, 11 — License: MIT
  • Three algorithm variants covering 32/64/128-bit output widths.
  • Adapted from the Akka.NET project — see Credits.

On .NET 9+ these types are marked [Obsolete]. The BCL now ships System.IO.Hashing.XxHash*, which is faster and natively supported — prefer it unless you need to keep matching values you hashed with MurmurHash previously.


Install

dotnet add package CloudMesh.MurmurHash

Variants

Type Output Best for
MurmurHash 32-bit (int) Strings, arrays, and order-independent set hashing; incremental hashing primitives
MurmurHash2 64-bit (ulong) Scalars, byte arrays, and strings where a wider hash is wanted (MurmurHash64A)
MurmurHash3 128-bit (two ulong, byte[16], or Guid) Content fingerprints and compact deterministic keys (x64 128-bit variant)

All types live in the CloudMesh.Utils namespace.

Usage

32-bit — MurmurHash

using CloudMesh.Utils;

int h1 = MurmurHash.StringHash("hello");          // stable across processes
int h2 = MurmurHash.ByteHash(payloadBytes);
int h3 = MurmurHash.ArrayHash(new[] { 1, 2, 3 }); // order-sensitive

// Order-independent hash of a set:
int setHash = MurmurHash.SymmetricHash(new[] { "a", "b", "c" }, seed: 0);

// Or fold values into a running hash yourself:
uint acc = MurmurHash.StartHash(seed: 42);
acc = MurmurHash.ExtendHash(acc, value: 7, MurmurHash.StartMagicA, MurmurHash.StartMagicB);
int final = (int)MurmurHash.FinalizeHash(acc);

64-bit — MurmurHash2

using CloudMesh.Utils;

ulong a = MurmurHash2.HashString("hello");
ulong b = MurmurHash2.Hash(payloadBytes);
ulong c = MurmurHash2.Hash(1234UL, seed: 99);

128-bit — MurmurHash3

using CloudMesh.Utils;

var (h1, h2) = MurmurHash3.ComputeHash(payload);       // two 64-bit halves
byte[] bytes = MurmurHash3.ComputeHashToBytes(payload); // 16-byte digest
Guid fingerprint = MurmurHash3.ComputeHashToGuid(payload); // compact, deterministic key

ComputeHashToGuid is a convenient way to derive a stable, collision-resistant Guid key from arbitrary content.

Use cases

  • Sharding / partitioning keys deterministically across nodes or buckets.
  • Content fingerprints for de-duplication and change detection.
  • Bloom filters and hash tables needing fast, well-mixed hashes.
  • Consistent, cross-process hashing where GetHashCode() (which is randomized per run) won't do.

Gotchas

  • Not cryptographic. Do not use for passwords, signatures, or anything security-sensitive.
  • MurmurHash2 and MurmurHash3 are endian-dependent (they read the buffer through unsafe pointers), so values are stable on a given architecture but not guaranteed identical across differing endianness.
  • The variants are not interchangeable — 32/64/128-bit outputs, and the x64 vs x86 MurmurHash3 layouts, produce different values.
  • On .NET 9+, expect an obsolete warning nudging you toward System.IO.Hashing.XxHash*.

Credits

The 32-bit MurmurHash implementation is adapted from the Akka.NET project (Apache 2.0), originally authored by Aaron Stannard. MurmurHash3 is adapted from Grassfed.MurmurHash3, itself a port of Austin Appleby's public-domain SMHasher reference. All credit for the original algorithms and implementations goes to those authors.


MIT © Jessie Wadman. Part of CloudMesh.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.0

    • No dependencies.
  • net11.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CloudMesh.MurmurHash:

Package Downloads
CloudMesh.Persistence.DynamoDB

Lightweight repository pattern for AWS DynamoDB

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.108 0 11/21/2026
2.0.107 108 11/14/2026
2.0.105 102 11/12/2026
2.0.104 113 11/9/2026
2.0.103 200 9/25/2026
2.0.101 182 8/29/2026
2.0.100 186 8/3/2026
2.0.99 167 7/14/2026
2.0.98 154 7/14/2026
2.0.97 149 7/14/2026
2.0.96 154 6/28/2026
2.0.95 148 6/28/2026
2.0.94 151 6/28/2026
2.0.93 155 6/27/2026
2.0.92 167 6/23/2026
2.0.89 2,252 12/18/2025
2.0.87-preview 2,277 8/11/2025
2.0.85-preview 2,738 1/29/2025
2.0.76-preview 221 1/15/2025
2.0.75-preview 203 1/15/2025
Loading failed