Go to file
Melnik Alexander 4d44f67192
Update Readme
2018-05-13 23:43:33 +03:00
src Add Streaming API 2018-05-13 13:48:53 +03:00
.gitignore Initial commit 2018-04-08 14:29:55 +03:00
appveyor.yml Added CI config 2018-04-22 15:32:20 +03:00
build.cmd Changed the structure of the project 2018-04-22 15:24:45 +03:00
deps.props Add Streaming API 2018-05-13 13:48:53 +03:00
LICENSE Initial commit 2018-04-08 14:29:55 +03:00
nuget.props Add Streaming API 2018-05-13 13:48:53 +03:00
README.md Update Readme 2018-05-13 23:43:33 +03:00

xxHash.st

Extremely fast non-cryptographic hash algorithm xxhash


build license

xxHash is an Extremely fast Hash algorithm, running at RAM speed limits. It successfully completes the SMHasher test suite which evaluates collision, dispersion and randomness qualities of hash functions.

Benchmarks

This benchmark was launched on a Windows 10 (10.0.16299.309). The reference system uses a Intel Core i7-4700MQ CPU 2.40GHz (Haswell)

Method x64
Hash32 Array 5.05 GB/s
Hash64 Array 8.92 GB/s
Hash32 Stream 3.22 GB/s
Hash64 Stream 4.81 GB/s

Api

public static uint ComputeHash(byte[] data, int length, uint seed = 0) { throw null; }
public static uint ComputeHash(Stream stream, int bufferSize = 4096, uint seed = 0) { throw null; }
public static async Task<uint> ComputeHashAsync(Stream stream, int bufferSize = 4096, uint seed = 0) { throw null; }

public static ulong ComputeHash(byte[] data, int length, ulong seed = 0) { throw null; }
public static ulong ComputeHash(Stream stream, int bufferSize = 8192, ulong seed = 0) { throw null; }
public static async Task<ulong> ComputeHashAsync(Stream stream, int bufferSize = 8192, ulong seed = 0) { throw null; }

Examples

A few examples of how to use api

byte[] data = Encoding.UTF8.GetBytes("veni vidi vici");

ulong h64_1 = xxHash64.ComputeHash(data, data.Length);
ulong h64_2 = xxHash64.ComputeHash(new MemoryStream(data));
ulong h64_3 = await xxHash64.ComputeHashAsync(new MemoryStream(data));

uint h32_1 = xxHash32.ComputeHash(data, data.Length);
uint h32_2 = xxHash32.ComputeHash(new MemoryStream(data));
uint h32_3 = await xxHash32.ComputeHashAsync(new MemoryStream(data));