返回 DeepSeek-Reasonix
contentRevision.ts
根目录 / desktop / frontend / src / lib / contentRevision.ts
1 /** Deterministic UTF-16 content fingerprint used by transcript caches. */
2 export function contentRevision(text: string): number {
3 let hash = 0x811c9dc5;
4 for (let index = 0; index < text.length; index += 1) {
5 hash ^= text.charCodeAt(index);
6 hash = Math.imul(hash, 0x01000193);
7 }
8 return hash >>> 0;
9 }
10
10 lines TYPESCRIPT