MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / hash_bytes

Function hash_bytes

nodedb-query/src/msgpack_scan/aggregate.rs:414–421  ·  view source on GitHub ↗

FNV-1a hash for raw bytes (used by approx aggregates to feed HLL/SpaceSaving).

(bytes: &[u8])

Source from the content-addressed store, hash-verified

412
413/// FNV-1a hash for raw bytes (used by approx aggregates to feed HLL/SpaceSaving).
414fn hash_bytes(bytes: &[u8]) -> u64 {
415 let mut h: u64 = 0xcbf29ce484222325;
416 for &b in bytes {
417 h ^= b as u64;
418 h = h.wrapping_mul(0x100000001b3);
419 }
420 h
421}
422
423#[cfg(test)]
424mod tests {

Callers 1

compute_aggregate_binaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected