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

Function fxhash_multi

nodedb/src/engine/kv/hash_helpers.rs:56–64  ·  view source on GitHub ↗

Compute FxHash over multiple byte slices concatenated. Used by [`super::engine_helpers::table_key`] to hash `(tenant_id, collection)` without allocating a String. Same algorithm as [`hash_key`].

(slices: &[&[u8]])

Source from the content-addressed store, hash-verified

54/// Used by [`super::engine_helpers::table_key`] to hash `(tenant_id, collection)`
55/// without allocating a String. Same algorithm as [`hash_key`].
56pub(super) fn fxhash_multi(slices: &[&[u8]]) -> u64 {
57 let mut h: u64 = 0;
58 for slice in slices {
59 for &b in *slice {
60 h = h.rotate_left(5) ^ (b as u64).wrapping_mul(FX_SEED);
61 }
62 }
63 h
64}
65
66// ---------------------------------------------------------------------------
67// Value storage operations (avoids borrow conflicts in hash table methods)

Callers 1

table_keyFunction · 0.85

Calls 1

rotate_leftMethod · 0.80

Tested by

no test coverage detected