[][src]Module fasthash::metro

MetroHash, Exceptionally fast and statistically robust hash functions

by J. Andrew Rogers

https://github.com/jandrewrogers/metrohash

MetroHash is a set of state-of-the-art hash functions for non-cryptographic use cases. They are notable for being algorithmically generated in addition to their exceptional performance. The set of published hash functions may be expanded in the future, having been selected from a very large set of hash functions that have been constructed this way.

Fastest general-purpose functions for bulk hashing. Fastest general-purpose functions for small, variable length keys. Robust statistical bias profile, similar to the MD5 cryptographic hash. Hashes can be constructed incrementally (new) 64-bit, 128-bit, and 128-bit CRC variants currently available. Optimized for modern x86-64 microarchitectures. Elegant, compact, readable functions.

You can read more about the design and history here.

Example

use std::hash::{Hash, Hasher};

use fasthash::{metro, MetroHasher};

fn hash<T: Hash>(t: &T) -> u64 {
    let mut s: MetroHasher = Default::default();
    t.hash(&mut s);
    s.finish()
}

let h = metro::hash64(b"hello world\xff");

assert_eq!(h, hash(&"hello world"));

Modules

crc

hash functions using HW CRC instruction.

Structs

Hash128_1

MetroHash 128-bit hash functions

Hash128_2

MetroHash 128-bit hash functions

Hash64_1

MetroHash 64-bit hash functions

Hash64_2

MetroHash 64-bit hash functions

Hasher128_1

An implementation of std::hash::Hasher and fasthash::HasherExt.

Hasher128_2

An implementation of std::hash::Hasher and fasthash::HasherExt.

Hasher64_1

An implementation of std::hash::Hasher.

Hasher64_2

An implementation of std::hash::Hasher.

Functions

hash64

MetroHash 64-bit hash function for a byte array using HW CRC instruction.

hash64_with_seed

MetroHash 64-bit hash function for a byte array using HW CRC instruction. For convenience, a 64-bit seed is also hashed into the result.

hash128

MetroHash 128-bit hash function for a byte array using HW CRC instruction.

hash128_with_seed

MetroHash 128-bit hash function for a byte array. using HW CRC instruction. For convenience, a 128-bit seed is also hashed into the result.