MCPcopy Create free account
hub / github.com/echoVic/blade-code / hashInput

Method hashInput

src/context/storage/CacheStore.ts:259–268  ·  view source on GitHub ↗

* 简单的输入哈希函数

(input: any)

Source from the content-addressed store, hash-verified

257 * 简单的输入哈希函数
258 */
259 private hashInput(input: any): string {
260 const str = JSON.stringify(input);
261 let hash = 0;
262 for (let i = 0; i < str.length; i++) {
263 const char = str.charCodeAt(i);
264 hash = (hash << 5) - hash + char;
265 hash = hash & hash; // Convert to 32-bit integer
266 }
267 return Math.abs(hash).toString(36);
268 }
269
270 /**
271 * 估算缓存项大小

Callers 2

cacheToolResultMethod · 0.95
getToolResultMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected