1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.hash = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function murmurhash2_32_gc(str, seed = 0) {
|
17 | var l = str.length, h = seed ^ l, i = 0, k;
|
18 | while (l >= 4) {
|
19 | k =
|
20 | (str.charCodeAt(i) & 0xff) |
|
21 | ((str.charCodeAt(++i) & 0xff) << 8) |
|
22 | ((str.charCodeAt(++i) & 0xff) << 16) |
|
23 | ((str.charCodeAt(++i) & 0xff) << 24);
|
24 | k =
|
25 | (k & 0xffff) * 0x5bd1e995 +
|
26 | ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16);
|
27 | k ^= k >>> 24;
|
28 | k =
|
29 | (k & 0xffff) * 0x5bd1e995 +
|
30 | ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16);
|
31 | h =
|
32 | ((h & 0xffff) * 0x5bd1e995 +
|
33 | ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^
|
34 | k;
|
35 | l -= 4;
|
36 | ++i;
|
37 | }
|
38 | switch (l) {
|
39 | case 3:
|
40 | h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
41 | case 2:
|
42 | h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
43 | case 1:
|
44 | h ^= str.charCodeAt(i) & 0xff;
|
45 | h =
|
46 | (h & 0xffff) * 0x5bd1e995 +
|
47 | ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16);
|
48 | }
|
49 | h ^= h >>> 13;
|
50 | h =
|
51 | (h & 0xffff) * 0x5bd1e995 +
|
52 | ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16);
|
53 | h ^= h >>> 15;
|
54 | return h >>> 0;
|
55 | }
|
56 | function hash(str) {
|
57 | return murmurhash2_32_gc(str).toString(36);
|
58 | }
|
59 | exports.hash = hash;
|