Lines Matching refs:hash
11 //! Fast, non-cryptographic hash used by rustc and Firefox.
34 use core::hash::BuildHasherDefault;
35 use core::hash::Hasher;
41 /// Type alias for a hashmap using the `fx` hash algorithm.
45 /// Type alias for a hashmap using the `fx` hash algorithm.
49 /// A speedy hash algorithm for use within rustc. The hashmap in liballoc
52 /// non-cryptographic hash.
56 /// 64-bit hash values instead of 32-bit hash values. It consistently
57 /// out-performs an FNV-based hash within rustc itself -- the collision rate is
58 /// similar or slightly worse than FNV, but the speed of the hash function
61 hash: usize,
72 FxHasher { hash: 0 }
79 self.hash = self.hash.rotate_left(5).bitxor(i).wrapping_mul(K);
91 let mut hash = FxHasher { hash: self.hash };
94 hash.add_to_hash(read_usize(bytes) as usize);
98 hash.add_to_hash(u32::from_ne_bytes(bytes[..4].try_into().unwrap()) as usize);
102 hash.add_to_hash(u16::from_ne_bytes(bytes[..2].try_into().unwrap()) as usize);
106 hash.add_to_hash(bytes[0] as usize);
108 self.hash = hash.hash;
146 self.hash as u64