MCPcopy Create free account
hub / github.com/anomalyco/opencode / checksum

Function checksum

packages/core/src/util/encode.ts:22–30  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

20}
21
22export function checksum(content: string): string | undefined {
23 if (!content) return undefined
24 let hash = 0x811c9dc5
25 for (let i = 0; i < content.length; i++) {
26 hash ^= content.charCodeAt(i)
27 hash = Math.imul(hash, 0x01000193)
28 }
29 return (hash >>> 0).toString(36)
30}
31
32export function sampledChecksum(content: string, limit = 500_000): string | undefined {
33 if (!content) return undefined

Callers 13

selectProviderFunction · 0.90
selectWebSearchProviderFunction · 0.90
RawMessageContentFunction · 0.90
workspaceStorageFunction · 0.90
draftStorageFunction · 0.90
reviewDiffIdFunction · 0.90
contextItemKeyFunction · 0.90
initialResultFunction · 0.90
MarkdownFunction · 0.90
preloadMarkdownFunction · 0.90
diffIdFunction · 0.90
renderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected