Skip to content

Instantly share code, notes, and snippets.

View DaniBarca's full-sized avatar
👻

Dani Barca Casafont DaniBarca

👻
View GitHub Profile
@rasmuskl
rasmuskl / fnv64a1.cs
Created September 26, 2012 07:39
FNV 1a 64-bit C# non-cryptographic hash
// FNV-1a (64-bit) non-cryptographic hash function.
// Adapted from: http://github.com/jakedouglas/fnv-java
public ulong HashFNV1a(byte[] bytes)
{
const ulong fnv64Offset = 14695981039346656037;
const ulong fnv64Prime = 0x100000001b3;
ulong hash = fnv64Offset;
for (var i = 0; i < bytes.Length; i++)
{