Farmhash.Sharp

Farmhash.Sharp is a .NET port of Google's Farmhash algorithm for calculating 32bit and 64bit non-cryptographic hashes. Farmhash.Sharp has great performance characteristics when calculating 64bit hashes, especially on short strings or a subsequence of byte arrays.

Quickstart

dotnet add package Farmhash.Sharp
using Farmhash.Sharp;

ulong hash64 = Farmhash.Hash64("Hello world");
uint hash32 = Farmhash.Hash32("Hello world");

var data = new byte[] {72, 105};
ulong dhash64 = Farmhash.Hash64(data, data.Length);

// For .NET core app 2.1+
ReadOnlySpan<byte> sp = data;
ulong hash2 = Farmhash.Hash64(sp);

Links

  • Overview
  • NuGet Link
  • Motivation behind this library
  • Compare C# farmhash performance to C++
  • Compare C# farmhash to other C# hash libraries
Back to top Copyright © 2015-. Contributors of Farmhash.Sharp