MCPcopy Create free account
hub / github.com/Fennec-hub/three-wfc / hashArray

Function hashArray

lib/utils/hashArray.ts:7–22  ·  view source on GitHub ↗
(array: (string | number)[])

Source from the content-addressed store, hash-verified

5 * @returns The computed hash value.
6 */
7export const hashArray = (array: (string | number)[]) => {
8 let hash = 0x811c9dc5;
9
10 for (let i = 0, li = array.length; i < li; i++) {
11 const str = `${array[i]}`;
12 hash ^= str.length;
13 hash = Math.imul(hash, 0x01000193) >>> 0;
14
15 for (let j = 0, lj = str.length; j < lj; j++) {
16 hash ^= str.charCodeAt(j);
17 hash = Math.imul(hash, 0x01000193) >>> 0;
18 }
19 }
20
21 return hash;
22};

Callers 1

_initializeMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected