#hash #t1ha

no-std t1ha

An implementation of the T1AH (Fast Positive Hash) hash function

1 unstable release

0.1.0 Mar 7, 2019

#734 in Algorithms

Download history 1811/week @ 2021-10-03 2041/week @ 2021-10-10 1617/week @ 2021-10-17 1689/week @ 2021-10-24 1888/week @ 2021-10-31 1996/week @ 2021-11-07 2052/week @ 2021-11-14 1624/week @ 2021-11-21 938/week @ 2021-11-28 1806/week @ 2021-12-05 1542/week @ 2021-12-12 724/week @ 2021-12-19 660/week @ 2021-12-26 1452/week @ 2022-01-02 1087/week @ 2022-01-09 1089/week @ 2022-01-16

4,313 downloads per month

Zlib license


rust-t1ha travis appveyor crate docs

An implementation of the T1AH (Fast Positive Hash) hash function.

Briefly, it is a portable 64-bit hash function:

  • Intended for 64-bit little-endian platforms, predominantly for Elbrus and x86_64, but portable and without penalties it can run on any 64-bit CPU.
  • In most cases up to 15% faster than StadtX hash, xxHash, mum-hash, metro-hash, etc. and all others portable hash-functions (which do not use specific hardware tricks).
  • Provides a set of terraced hash functions.
  • Currently not suitable for cryptography.
  • Licensed under zlib License.


To include this crate in your program, add the following to your Cargo.toml:

t1ha = "0.1"

Using t1ha in a HashMap

The T1haHashMap type alias is the easiest way to use the standard library’s HashMap with t1ha.

use t1ha::T1haHashMap;

let mut map = T1haHashMap::default();
map.insert(1, "one");
map.insert(2, "two");

map = T1haHashMap::with_capacity_and_hasher(10, Default::default());
map.insert(1, "one");
map.insert(2, "two");

Note: the standard library’s HashMap::new and HashMap::with_capacity are only implemented for the RandomState hasher, so using Default to get the hasher is the next best option.

Using t1ha in a HashSet

Similarly, T1haHashSet is a type alias for the standard library’s HashSet with `t1ha.

use t1ha::T1haHashSet;

let mut set = T1haHashSet::default();

set = T1haHashSet::with_capacity_and_hasher(10, Default::default());