FastHashes

September 10, 2022 ยท View on GitHub

FashHashes is a suite of .NET non-cryptographic hash functions.

Status: Build Coverage
Info: License Lines Size
NuGet: Version Downloads
Donation: PayPal

Main Features

  • High Performing: deeply-optimized code makes extensive use of method inlining and unsafe memory pointers in order to speed up the computations.
  • Allocation Free: all the internal functions follow a zero-allocation approach, only primitive types and/or arrays of primitive types are used by the algorithms.
  • Endian-Agnostic: all the hashes provide consistent results regardless of the machine byte order, while only moderately affecting the overall performance of the computations.
  • Platform-Agnostic: the code has been developed under .NET Standard framework and both x86 and x64 environments are fully supported.
  • Fully Managed: since version 3.0.0, pointers requiring unsafe memory access contexts have been completely removed and the library is now fully managed.

Hashes

The library includes the following non-cryptographic hashes:

Requirements

The following Frameworks are supported:

  • Library: .NET Standard 2.0, .NET Standard 2.1
  • Auxiliary Projects: .NET Core 2.1, .NET Core 3.1, .NET 5.0, .NET 6.0

The following NuGet packages are required for performing unit tests:

Performance Benchmarks

Hash RankHash NameBulk Speed Test Average โ†“Chunks Speed Test Average
-DummyHash (Reference)609.34 GB/s2.06 GB/s
1FarmHash6411.47 GB/s626.60 MB/s
2FarmHash12811.27 GB/s641.03 MB/s
3MetroHash128-V111.11 GB/s636.52 MB/s
4MetroHash64-V111.10 GB/s628.81 MB/s
5MetroHash128-V211.06 GB/s635.34 MB/s
6MetroHash64-V211.05 GB/s620.92 MB/s
7XxHash6410.03 GB/s596.90 MB/s
8Mx3Hash9.31 GB/s545.03 MB/s
9PengyHash8.73 GB/s517.22 MB/s
10MurmurHash128-x646.70 GB/s485.59 MB/s
11MurmurHash64-x646.56 GB/s467.14 MB/s
12XxHash326.43 GB/s482.92 MB/s
13FastHash645.34 GB/s444.45 MB/s
14FastHash325.26 GB/s440.91 MB/s
15WyHash324.38 GB/s389.76 MB/s
16FarmHash324.27 GB/s394.83 MB/s
17FastPositiveHash-V14.10 GB/s386.51 MB/s
18MurmurHash128-x864.05 GB/s383.60 MB/s
19MurmurHash64-x864.01 GB/s374.73 MB/s
20FastPositiveHash-V23.99 GB/s386.33 MB/s
21MurmurHash322.82 GB/s332.35 MB/s
22MumHash2.44 GB/s312.24 MB/s
23WyHash642.39 GB/s340.13 MB/s
24KomiHash2.31 GB/s331.88 MB/s
25FastPositiveHash-V02.29 GB/s320.69 MB/s
26MirHash2.03 GB/s298.14 MB/s
27SipHash-131.28 GB/s230.67 MB/s
28HighwayHash256914.16 MB/s125.78 MB/s
29HighwayHash64899.65 MB/s151.54 MB/s
30HighwayHash128883.51 MB/s143.84 MB/s
31SpookyHash32752.43 MB/s156.79 MB/s
32SpookyHash64734.84 MB/s149.36 MB/s
33SipHash-24734.74 MB/s168.43 MB/s
34SpookyHash128723.91 MB/s155.67 MB/s
35HalfSipHash364.78 MB/s119.96 MB/s

The tests above have been conducted with the following machine setup:

  • CPU: Intel Core i7-7700HQ @2.80GHz (4 Cores, 8 Threads, 256KB L1 Cache)
  • RAM: 16 GB x DDR4 SO-DIMM @1200MHz
  • OS: Microsoft Windows 10 64-Bit