MCPcopy Create free account
hub / github.com/PerroEngine/Perro / hash_bytes

Function hash_bytes

perro_source/api_modules/perro_modules/src/random.rs:166–173  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

164
165#[inline]
166pub 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]
176pub fn hash_str(value: &str) -> u32 {

Callers 1

hash_strFunction · 0.85

Calls 2

hash_u32Function · 0.70
lenMethod · 0.45

Tested by

no test coverage detected