MCPcopy Index your code
hub / github.com/modem-dev/hunk / sourceTextFingerprint

Function sourceTextFingerprint

src/ui/diff/diffSectionGeometry.ts:42–51  ·  view source on GitHub ↗

Fingerprint loaded source text so same-length edits invalidate geometry.

(text: string)

Source from the content-addressed store, hash-verified

40
41/** Fingerprint loaded source text so same-length edits invalidate geometry. */
42function sourceTextFingerprint(text: string) {
43 let hash = 2166136261;
44
45 for (let index = 0; index < text.length; index += 1) {
46 hash ^= text.charCodeAt(index);
47 hash = Math.imul(hash, 16777619);
48 }
49
50 return `${text.length}:${(hash >>> 0).toString(36)}`;
51}
52
53/** Stable suffix that captures note content/order for the geometry cache key. */
54function notesCacheKey(visibleAgentNotes: VisibleAgentNote[]) {

Callers 1

expansionCacheKeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected