Module fasthash::t1ha [] [src]

Fast Positive Hash, aka "Позитивный Хэш"

by Positive Technologies.

https://github.com/leo-yuriev/t1ha

Briefly, it is a 64-bit Hash Function:

Created for 64-bit little-endian platforms, in predominantly for x86_64, but without penalties could runs on any 64-bit CPU. In most cases up to 15% faster than City64, xxHash, mum-hash, metro-hash and all others which are not use specific hardware tricks. Not suitable for cryptography. Please see t1ha.c for implementation details.

Acknowledgement:

The t1ha was originally developed by Leonid Yuriev (Леонид Юрьев) for The 1Hippeus project - zerocopy messaging in the spirit of Sparta!

Requirements and Portability:

t1ha designed for modern 64-bit architectures. But on the other hand, t1ha doesn't uses any one tricks nor instructions specific to any particular architecture: therefore t1ha could be used on any CPU for which GCC provides support 64-bit arithmetics. but unfortunately t1ha could be dramatically slowly on architectures without native 64-bit operations. This implementation of t1ha requires modern GNU C compatible compiler, includes Clang/LLVM; or MSVC++ 14.0 (Visual Studio 2015).

Example

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

use fasthash::{t1ha, T1haHasher};

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

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

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

Structs

T1ha32Be

T1Hash 32-bit hash functions for 32-bit big-endian platforms.

T1ha32BeHasher

An implementation of std::hash::Hasher.

T1ha32Le

T1Hash 32-bit hash functions for 32-bit little-endian platforms.

T1ha32LeHasher

An implementation of std::hash::Hasher.

T1ha64Be

T1Hash 64-bit hash functions for 64-bit big-endian platforms.

T1ha64BeHasher

An implementation of std::hash::Hasher.

T1ha64Crc

T1Hash 64-bit hash functions using HW CRC instruction for 64-bit little-endian platforms.

T1ha64CrcHasher

An implementation of std::hash::Hasher.

T1ha64Le

T1Hash 64-bit hash functions for 64-bit little-endian platforms.

T1ha64LeHasher

An implementation of std::hash::Hasher.

Functions

hash32

T1Hash 32-bit hash functions for a byte array.

hash64

T1Hash 64-bit hash function for a byte array using HW CRC instruction. That require SSE4.2 instructions to be available.

hash32_with_seed

T1Hash 32-bit hash function for a byte array. For convenience, a 32-bit seed is also hashed into the result.

hash64_with_seed

T1Hash 64-bit hash function for a byte array using HW CRC instruction. That require SSE4.2 instructions to be available. For convenience, a 64-bit seed is also hashed into the result.