agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
28 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fnv1a = void 0;
/**
* fnv1a — the one 32-bit content hash this library uses.
*
* Pattern: leaf utility (imports nothing).
* Role: shared by the slot composers (`core/slots/helpers.ts`, which
* re-exports it under the same name) and by the memory layer's
* retrieval record. It lives here rather than in either of them
* because `memory/` must not import `core/` — `core/` already
* imports `memory/`, and a second hash implementation is how two
* recordings of the same bytes end up disagreeing about their id.
* Emits: N/A.
*
* Not cryptographic and not meant to be: this identifies content for
* dedup and correlation inside one recording, never for authentication.
*/
function fnv1a(input) {
let h = 2166136261;
for (let i = 0; i < input.length; i++) {
h ^= input.charCodeAt(i);
h = Math.imul(h, 16777619);
}
return (h >>> 0).toString(16);
}
exports.fnv1a = fnv1a;
//# sourceMappingURL=fnv1a.js.map