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

Function test_fnv1a

nodedb-query/src/msgpack_scan/sidecar.rs:538–545  ·  view source on GitHub ↗

Compute FNV-1a hash the same way the module does (duplicated in test for constructing colliding sidecar entries without exposing the private fn).

(s: &str)

Source from the content-addressed store, hash-verified

536 /// Compute FNV-1a hash the same way the module does (duplicated in test for
537 /// constructing colliding sidecar entries without exposing the private fn).
538 fn test_fnv1a(s: &str) -> u64 {
539 let mut hash: u64 = 0xcbf29ce484222325;
540 for &b in s.as_bytes() {
541 hash ^= b as u64;
542 hash = hash.wrapping_mul(0x100000001b3);
543 }
544 hash
545 }
546
547 /// Inject two sidecar entries with the same hash but different field names,
548 /// then verify that lookup correctly returns the right value for each field

Callers 1

Calls 1

as_bytesMethod · 0.45

Tested by

no test coverage detected