#hashing #idea #city-hash #google #austin #murmur-hash #appleby

farmhash

Farmhash is a successor to Cityhash (also from Google). Farmhash, like Cityhash before it, use ideas from Austin Appleby's MurmurHash.

6 stable releases

Uses old Rust 2015

1.1.5 Mar 20, 2016
1.1.4 Sep 2, 2015
1.1.2 Jul 15, 2015
1.1.0 Jul 13, 2015

#4 in #idea

Download history 7883/week @ 2024-03-14 7887/week @ 2024-03-21 6519/week @ 2024-03-28 7467/week @ 2024-04-04 22724/week @ 2024-04-11 21573/week @ 2024-04-18 17859/week @ 2024-04-25 17016/week @ 2024-05-02 16416/week @ 2024-05-09 19523/week @ 2024-05-16 22997/week @ 2024-05-23 19694/week @ 2024-05-30 19930/week @ 2024-06-06 20152/week @ 2024-06-13 17711/week @ 2024-06-20 13508/week @ 2024-06-27

74,774 downloads per month
Used in 15 crates (14 directly)

MIT license

2MB
982 lines

rust-farmhash

Port of Google's Farmhash version 1.1 to pure Rust

For more on Farmhash see https://code.google.com/p/farmhash/

Farmhash is a successor to Cityhash (also from Google). Farmhash, like Cityhash before it, use ideas from Austin Appleby's MurmurHash.

Example usage

extern crate farmhash;

...

let value: &str = "hello world";
let res32 = farmhash::hash32(&value.as_bytes());
// res32 ==> 430397466
let res64 = farmhash::hash64(&value.as_bytes());
// res64 ==> 6381520714923946011

Benchmarks

Tested on /usr/share/dict/web2 on Mac OSX

farmhash: required 0.06485s with 0/235887 collisions
fnv:      required 0.12042s with 1/235887 collisions
siphash:  required 0.23546s with 0/235887 collisions

Note

Since FarmHash is not a streaming hash. It is recommended to use the function hash64 or hash32 directly. Using the hasher interface will give you a different result if you write the same bytearray in chunks before calling finish.

No runtime deps