MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / content_key

Function content_key

atomic-objects/src/lib.rs:49–51  ·  view source on GitHub ↗

Compute the canonical content address (lowercase hex Blake3) of arbitrary object bytes. Every object family keys itself with this, so the transport never needs to know an object's type to verify it: `content_key(bytes) == key` is a universal, type-agnostic integrity check.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

47/// never needs to know an object's type to verify it: `content_key(bytes) ==
48/// key` is a universal, type-agnostic integrity check.
49pub fn content_key(bytes: &[u8]) -> ObjectKey {
50 blake3::hash(bytes).to_hex().to_string()
51}
52
53/// Whether `bytes` hash to `key` — the content-addressed integrity check the
54/// bare server runs on every `PUT /{family}/{key}` before storing.

Callers 7

observe_worktreeFunction · 0.85
newMethod · 0.85
rootMethod · 0.85
observedFunction · 0.85
content_keyMethod · 0.85
verify_keyFunction · 0.85

Calls 2

hashFunction · 0.50
to_hexMethod · 0.45

Tested by 1

observedFunction · 0.68