Module hashers::fx_hash[][src]

From https://github.com/cbreeden/fxhash

This hashing algorithm was extracted from the Rustc compiler. This is the same hashing algorithm used for some internal operations in FireFox. The strength of this algorithm is in hashing 8 bytes at a time on 64-bit platforms, where the FNV algorithm works on one byte at a time.

This Hasher is imported from the fxhash crate.

Ok, its is a weird one. It chomps the data in 32- or 64- (or system-specific) bit bites, and is otherwise very, very simple. Literally, the algorithm is based around hashing a word: rotate_left(5).bitxor(word).wrapping_mul($key)

The complexity must be the $key value, right. In 64-bits, it is 0x517cc1b727220a95. What's that, you ask?

$ bc
ibase = 16
517CC1B727220A95
5871781006564002453
...
scale = 15
(2^64) / 5871781006564002453
3.141592653589793

For those not in the bc inner circle, 0x517cc1b727220a95 = 5871781006564002453, which when divided into 2^64 is 3.14159, i.e. π.

So, yeah.

The fxhash crate provides both 32- and 64-bit versions, as well as FxHasher, which uses the system bit-width.

Structs

FxHasher

This hashing algorithm was extracted from the Rustc compiler. This is the same hashing algoirthm used for some internal operations in FireFox. The strength of this algorithm is in hashing 8 bytes at a time on 64-bit platforms, where the FNV algorithm works on one byte at a time.

FxHasher32

This hashing algorithm was extracted from the Rustc compiler. This is the same hashing algoirthm used for some internal operations in FireFox. The strength of this algorithm is in hashing 4 bytes at a time on any platform, where the FNV algorithm works on one byte at a time.

FxHasher64

This hashing algorithm was extracted from the Rustc compiler. This is the same hashing algoirthm used for some internal operations in FireFox. The strength of this algorithm is in hashing 8 bytes at a time on any platform, where the FNV algorithm works on one byte at a time.

Functions

fxhash
fxhash32
fxhash64