UNPKG

@cornerstonejs/core

Version:
10 lines (9 loc) 290 B
export default function fnv1aHash(str) { let hash = 0x811c9dc5; for (let i = 0; i < str.length; i++) { hash ^= str.charCodeAt(i); hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24); } return (hash >>> 0).toString(36); }