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

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 12708/week @ 2024-09-27 13358/week @ 2024-10-04 14423/week @ 2024-10-11 15397/week @ 2024-10-18 15024/week @ 2024-10-25 14695/week @ 2024-11-01 13355/week @ 2024-11-08 14906/week @ 2024-11-15 5915/week @ 2024-11-22 10496/week @ 2024-11-29 28374/week @ 2024-12-06 32159/week @ 2024-12-13 5555/week @ 2024-12-20 4612/week @ 2024-12-27 22882/week @ 2025-01-03 24907/week @ 2025-01-10

60,606 downloads per month
Used in 18 crates (17 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