MCPcopy Create free account
hub / github.com/modem-dev/hunk / sourceTextFingerprint

Function sourceTextFingerprint

src/ui/diff/useHighlightedSource.ts:12–21  ·  view source on GitHub ↗

Summarize loaded source text for expansion highlighting invalidation.

(text: string)

Source from the content-addressed store, hash-verified

10
11/** Summarize loaded source text for expansion highlighting invalidation. */
12function sourceTextFingerprint(text: string) {
13 let hash = 2166136261;
14
15 for (let index = 0; index < text.length; index += 1) {
16 hash ^= text.charCodeAt(index);
17 hash = Math.imul(hash, 16777619);
18 }
19
20 return `${text.length}:${(hash >>> 0).toString(36)}`;
21}
22
23/** Cache key for full-source highlights used by expanded unchanged rows. */
24function buildSourceCacheKey(theme: AppTheme, file: DiffFile, text: string) {

Callers 1

buildSourceCacheKeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected