(bytes: &[u8])
| 164 | |
| 165 | #[inline] |
| 166 | pub fn hash_bytes(bytes: &[u8]) -> u32 { |
| 167 | let mut hash = FNV1A_OFFSET; |
| 168 | for &byte in bytes { |
| 169 | hash ^= byte as u32; |
| 170 | hash = hash.wrapping_mul(FNV1A_PRIME); |
| 171 | } |
| 172 | hash_u32(hash ^ bytes.len() as u32) |
| 173 | } |
| 174 | |
| 175 | #[inline] |
| 176 | pub fn hash_str(value: &str) -> u32 { |