Module fasthash::metro [] [src]

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"));

Structs

MetroHash128Crc_1

MetroHash 128-bit hash functions using HW CRC instruction.

MetroHash128Crc_2

MetroHash 128-bit hash functions using HW CRC instruction.

MetroHash128_1

MetroHash 128-bit hash functions

MetroHash128_2

MetroHash 128-bit hash functions

MetroHash64Crc_1

MetroHash 64-bit hash functions using HW CRC instruction.

MetroHash64Crc_2

MetroHash 64-bit hash functions using HW CRC instruction.

MetroHash64_1

MetroHash 64-bit hash functions

MetroHash64_2

MetroHash 64-bit hash functions

MetroHasher128Crc_1

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

MetroHasher128Crc_2

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

MetroHasher128_1

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

MetroHasher128_2

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

MetroHasher64Crc_1

An implementation of std::hash::Hasher.

MetroHasher64Crc_2

An implementation of std::hash::Hasher.

MetroHasher64_1

An implementation of std::hash::Hasher.

MetroHasher64_2

An implementation of std::hash::Hasher.

Functions

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.

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.