GitXplorerGitXplorer
f

rust-fasthash

public
139 stars
30 forks
12 issues

Commits

List of commits on branch master.
Unverified
ef0c52b4157af9a1a7d19b2a37658b6c26a6bea6

remove UMASH_LONG_INPUTS

fflier committed 3 years ago
Unverified
5ddbe14fd565ec1d5c8d882fbe05f4c796b6d113

use smhasher/t1ha instead of origin

fflier committed 3 years ago
Unverified
c94dd12c88e1a05850ce2590e49145ca0b2a0778

add umash

fflier committed 3 years ago
Unverified
9e1666faf55d2a59fbfd03c22e5321362472c98a

remove travis

fflier committed 3 years ago
Unverified
853db8d609d5383ce6de5f7722bc96866de988f1

add -mpower8-vector for ppc64

fflier committed 3 years ago
Unverified
adcac7a0e85a614412bdd21d9c90096c2e8d7397

fix hint warning

fflier committed 3 years ago

README

The README file for this repository.

rust-fasthash Continuous integration crate docs

A suite of non-cryptographic hash functions for Rust, binding the smhasher.

Usage

[dependencies]
fasthash = "0.4"

hash and hash_with_seed function

use fasthash::*;

let h = city::hash64("hello world");

let h = metro::hash64_with_seed("hello world", 123);

std::hash::Hash

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

use fasthash::{MetroHasher, FastHasher};

fn hash<T: Hash>(t: &T) -> u64 {
    // Or use any of the `*Hasher` struct's available as aliases from
    // root or in their respective modules as Hasher32/64 and some 128.
    let mut s = MetroHasher::default();
    t.hash(&mut s);
    s.finish()
}

hash(&"hello world");

HashMap and HashSet

use std::collections::HashSet;

use fasthash::spooky::Hash128;

let mut set = HashSet::with_hasher(Hash128);

set.insert(2);

RandomState

use std::collections::HashMap;

use fasthash::RandomState;
use fasthash::city::Hash64;

let s = RandomState::<Hash64>::new();
let mut map = HashMap::with_hasher(s);

assert_eq!(map.insert(37, "a"), None);
assert_eq!(map.is_empty(), false);

map.insert(37, "b");
assert_eq!(map.insert(37, "c"), Some("b"));
assert_eq!(map[&37], "c");

Hash Functions

Benchmark

First install cargo-criterion:

$ cargo install cargo-criterion

Then you can use it to run Criterion-rs benchmarks:

$ cargo criterion