MCPcopy Index your code
hub / github.com/simstudioai/sim / simpleHash

Function simpleHash

apps/sim/lib/mcp/utils.ts:240–247  ·  view source on GitHub ↗

* Simple deterministic hash function that produces an 8-character hex string. * Uses a variant of djb2 hash algorithm.

(str: string)

Source from the content-addressed store, hash-verified

238 * Uses a variant of djb2 hash algorithm.
239 */
240function simpleHash(str: string): string {
241 let hash = 5381
242 for (let i = 0; i < str.length; i++) {
243 hash = (hash << 5) + hash + str.charCodeAt(i)
244 hash = hash >>> 0
245 }
246 return hash.toString(16).padStart(8, '0').slice(0, 8)
247}

Callers 1

generateMcpServerIdFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected