MCPcopy
hub / github.com/codeaashu/claude-code / hashContent

Function hashContent

src/utils/hash.ts:19–26  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

17 * sha256 and collision-resistant enough for diff detection (not crypto-safe).
18 */
19export function hashContent(content: string): string {
20 if (typeof Bun !== 'undefined') {
21 return Bun.hash(content).toString()
22 }
23 // eslint-disable-next-line @typescript-eslint/no-require-imports
24 const crypto = require('crypto') as typeof import('crypto')
25 return crypto.createHash('sha256').update(content).digest('hex')
26}
27
28/**
29 * Hash two strings without allocating a concatenated temp string. Bun path

Callers 1

cachedLexerFunction · 0.50

Calls 2

toStringMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected