MCPcopy Create free account
hub / github.com/freecodexyz/free-code / computeCch

Function computeCch

src/utils/cch.ts:16–20  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

14}
15
16export async function computeCch(body: string): Promise<string> {
17 const hasher = await getHasher()
18 const hash = hasher.h64Raw(new TextEncoder().encode(body), CCH_SEED)
19 return (hash & CCH_MASK).toString(16).padStart(5, '0')
20}
21
22export function replaceCchPlaceholder(body: string, cch: string): string {
23 return body.replace(CCH_PLACEHOLDER, `cch=${cch}`)

Callers 1

buildFetchFunction · 0.85

Calls 2

getHasherFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected