@mack1ch/fingerprint-js 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,574 +1,3 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
32
-
33
- // node_modules/js-md5/src/md5.js
34
- var require_md5 = __commonJS({
35
- "node_modules/js-md5/src/md5.js"(exports, module) {
36
- (function() {
37
- "use strict";
38
- var INPUT_ERROR = "input is invalid type";
39
- var FINALIZE_ERROR = "finalize already called";
40
- var WINDOW = typeof window === "object";
41
- var root = WINDOW ? window : {};
42
- if (root.JS_MD5_NO_WINDOW) {
43
- WINDOW = false;
44
- }
45
- var WEB_WORKER = !WINDOW && typeof self === "object";
46
- var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node;
47
- if (NODE_JS) {
48
- root = global;
49
- } else if (WEB_WORKER) {
50
- root = self;
51
- }
52
- var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === "object" && module.exports;
53
- var AMD = typeof define === "function" && define.amd;
54
- var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
55
- var HEX_CHARS = "0123456789abcdef".split("");
56
- var EXTRA = [128, 32768, 8388608, -2147483648];
57
- var SHIFT = [0, 8, 16, 24];
58
- var OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"];
59
- var BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
60
- var blocks = [], buffer8;
61
- if (ARRAY_BUFFER) {
62
- var buffer = new ArrayBuffer(68);
63
- buffer8 = new Uint8Array(buffer);
64
- blocks = new Uint32Array(buffer);
65
- }
66
- var isArray = Array.isArray;
67
- if (root.JS_MD5_NO_NODE_JS || !isArray) {
68
- isArray = function(obj) {
69
- return Object.prototype.toString.call(obj) === "[object Array]";
70
- };
71
- }
72
- var isView = ArrayBuffer.isView;
73
- if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !isView)) {
74
- isView = function(obj) {
75
- return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
76
- };
77
- }
78
- var formatMessage = function(message) {
79
- var type = typeof message;
80
- if (type === "string") {
81
- return [message, true];
82
- }
83
- if (type !== "object" || message === null) {
84
- throw new Error(INPUT_ERROR);
85
- }
86
- if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
87
- return [new Uint8Array(message), false];
88
- }
89
- if (!isArray(message) && !isView(message)) {
90
- throw new Error(INPUT_ERROR);
91
- }
92
- return [message, false];
93
- };
94
- var createOutputMethod = function(outputType) {
95
- return function(message) {
96
- return new Md5(true).update(message)[outputType]();
97
- };
98
- };
99
- var createMethod = function() {
100
- var method = createOutputMethod("hex");
101
- if (NODE_JS) {
102
- method = nodeWrap(method);
103
- }
104
- method.create = function() {
105
- return new Md5();
106
- };
107
- method.update = function(message) {
108
- return method.create().update(message);
109
- };
110
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
111
- var type = OUTPUT_TYPES[i];
112
- method[type] = createOutputMethod(type);
113
- }
114
- return method;
115
- };
116
- var nodeWrap = function(method) {
117
- var crypto2 = __require("crypto");
118
- var Buffer2 = __require("buffer").Buffer;
119
- var bufferFrom;
120
- if (Buffer2.from && !root.JS_MD5_NO_BUFFER_FROM) {
121
- bufferFrom = Buffer2.from;
122
- } else {
123
- bufferFrom = function(message) {
124
- return new Buffer2(message);
125
- };
126
- }
127
- var nodeMethod = function(message) {
128
- if (typeof message === "string") {
129
- return crypto2.createHash("md5").update(message, "utf8").digest("hex");
130
- } else {
131
- if (message === null || message === void 0) {
132
- throw new Error(INPUT_ERROR);
133
- } else if (message.constructor === ArrayBuffer) {
134
- message = new Uint8Array(message);
135
- }
136
- }
137
- if (isArray(message) || isView(message) || message.constructor === Buffer2) {
138
- return crypto2.createHash("md5").update(bufferFrom(message)).digest("hex");
139
- } else {
140
- return method(message);
141
- }
142
- };
143
- return nodeMethod;
144
- };
145
- var createHmacOutputMethod = function(outputType) {
146
- return function(key, message) {
147
- return new HmacMd5(key, true).update(message)[outputType]();
148
- };
149
- };
150
- var createHmacMethod = function() {
151
- var method = createHmacOutputMethod("hex");
152
- method.create = function(key) {
153
- return new HmacMd5(key);
154
- };
155
- method.update = function(key, message) {
156
- return method.create(key).update(message);
157
- };
158
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
159
- var type = OUTPUT_TYPES[i];
160
- method[type] = createHmacOutputMethod(type);
161
- }
162
- return method;
163
- };
164
- function Md5(sharedMemory) {
165
- if (sharedMemory) {
166
- blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
167
- this.blocks = blocks;
168
- this.buffer8 = buffer8;
169
- } else {
170
- if (ARRAY_BUFFER) {
171
- var buffer2 = new ArrayBuffer(68);
172
- this.buffer8 = new Uint8Array(buffer2);
173
- this.blocks = new Uint32Array(buffer2);
174
- } else {
175
- this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
176
- }
177
- }
178
- this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
179
- this.finalized = this.hashed = false;
180
- this.first = true;
181
- }
182
- Md5.prototype.update = function(message) {
183
- if (this.finalized) {
184
- throw new Error(FINALIZE_ERROR);
185
- }
186
- var result = formatMessage(message);
187
- message = result[0];
188
- var isString = result[1];
189
- var code, index = 0, i, length = message.length, blocks2 = this.blocks;
190
- var buffer82 = this.buffer8;
191
- while (index < length) {
192
- if (this.hashed) {
193
- this.hashed = false;
194
- blocks2[0] = blocks2[16];
195
- blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
196
- }
197
- if (isString) {
198
- if (ARRAY_BUFFER) {
199
- for (i = this.start; index < length && i < 64; ++index) {
200
- code = message.charCodeAt(index);
201
- if (code < 128) {
202
- buffer82[i++] = code;
203
- } else if (code < 2048) {
204
- buffer82[i++] = 192 | code >>> 6;
205
- buffer82[i++] = 128 | code & 63;
206
- } else if (code < 55296 || code >= 57344) {
207
- buffer82[i++] = 224 | code >>> 12;
208
- buffer82[i++] = 128 | code >>> 6 & 63;
209
- buffer82[i++] = 128 | code & 63;
210
- } else {
211
- code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
212
- buffer82[i++] = 240 | code >>> 18;
213
- buffer82[i++] = 128 | code >>> 12 & 63;
214
- buffer82[i++] = 128 | code >>> 6 & 63;
215
- buffer82[i++] = 128 | code & 63;
216
- }
217
- }
218
- } else {
219
- for (i = this.start; index < length && i < 64; ++index) {
220
- code = message.charCodeAt(index);
221
- if (code < 128) {
222
- blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
223
- } else if (code < 2048) {
224
- blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
225
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
226
- } else if (code < 55296 || code >= 57344) {
227
- blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
228
- blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
229
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
230
- } else {
231
- code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
232
- blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
233
- blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
234
- blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
235
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
236
- }
237
- }
238
- }
239
- } else {
240
- if (ARRAY_BUFFER) {
241
- for (i = this.start; index < length && i < 64; ++index) {
242
- buffer82[i++] = message[index];
243
- }
244
- } else {
245
- for (i = this.start; index < length && i < 64; ++index) {
246
- blocks2[i >>> 2] |= message[index] << SHIFT[i++ & 3];
247
- }
248
- }
249
- }
250
- this.lastByteIndex = i;
251
- this.bytes += i - this.start;
252
- if (i >= 64) {
253
- this.start = i - 64;
254
- this.hash();
255
- this.hashed = true;
256
- } else {
257
- this.start = i;
258
- }
259
- }
260
- if (this.bytes > 4294967295) {
261
- this.hBytes += this.bytes / 4294967296 << 0;
262
- this.bytes = this.bytes % 4294967296;
263
- }
264
- return this;
265
- };
266
- Md5.prototype.finalize = function() {
267
- if (this.finalized) {
268
- return;
269
- }
270
- this.finalized = true;
271
- var blocks2 = this.blocks, i = this.lastByteIndex;
272
- blocks2[i >>> 2] |= EXTRA[i & 3];
273
- if (i >= 56) {
274
- if (!this.hashed) {
275
- this.hash();
276
- }
277
- blocks2[0] = blocks2[16];
278
- blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
279
- }
280
- blocks2[14] = this.bytes << 3;
281
- blocks2[15] = this.hBytes << 3 | this.bytes >>> 29;
282
- this.hash();
283
- };
284
- Md5.prototype.hash = function() {
285
- var a, b, c, d, bc, da, blocks2 = this.blocks;
286
- if (this.first) {
287
- a = blocks2[0] - 680876937;
288
- a = (a << 7 | a >>> 25) - 271733879 << 0;
289
- d = (-1732584194 ^ a & 2004318071) + blocks2[1] - 117830708;
290
- d = (d << 12 | d >>> 20) + a << 0;
291
- c = (-271733879 ^ d & (a ^ -271733879)) + blocks2[2] - 1126478375;
292
- c = (c << 17 | c >>> 15) + d << 0;
293
- b = (a ^ c & (d ^ a)) + blocks2[3] - 1316259209;
294
- b = (b << 22 | b >>> 10) + c << 0;
295
- } else {
296
- a = this.h0;
297
- b = this.h1;
298
- c = this.h2;
299
- d = this.h3;
300
- a += (d ^ b & (c ^ d)) + blocks2[0] - 680876936;
301
- a = (a << 7 | a >>> 25) + b << 0;
302
- d += (c ^ a & (b ^ c)) + blocks2[1] - 389564586;
303
- d = (d << 12 | d >>> 20) + a << 0;
304
- c += (b ^ d & (a ^ b)) + blocks2[2] + 606105819;
305
- c = (c << 17 | c >>> 15) + d << 0;
306
- b += (a ^ c & (d ^ a)) + blocks2[3] - 1044525330;
307
- b = (b << 22 | b >>> 10) + c << 0;
308
- }
309
- a += (d ^ b & (c ^ d)) + blocks2[4] - 176418897;
310
- a = (a << 7 | a >>> 25) + b << 0;
311
- d += (c ^ a & (b ^ c)) + blocks2[5] + 1200080426;
312
- d = (d << 12 | d >>> 20) + a << 0;
313
- c += (b ^ d & (a ^ b)) + blocks2[6] - 1473231341;
314
- c = (c << 17 | c >>> 15) + d << 0;
315
- b += (a ^ c & (d ^ a)) + blocks2[7] - 45705983;
316
- b = (b << 22 | b >>> 10) + c << 0;
317
- a += (d ^ b & (c ^ d)) + blocks2[8] + 1770035416;
318
- a = (a << 7 | a >>> 25) + b << 0;
319
- d += (c ^ a & (b ^ c)) + blocks2[9] - 1958414417;
320
- d = (d << 12 | d >>> 20) + a << 0;
321
- c += (b ^ d & (a ^ b)) + blocks2[10] - 42063;
322
- c = (c << 17 | c >>> 15) + d << 0;
323
- b += (a ^ c & (d ^ a)) + blocks2[11] - 1990404162;
324
- b = (b << 22 | b >>> 10) + c << 0;
325
- a += (d ^ b & (c ^ d)) + blocks2[12] + 1804603682;
326
- a = (a << 7 | a >>> 25) + b << 0;
327
- d += (c ^ a & (b ^ c)) + blocks2[13] - 40341101;
328
- d = (d << 12 | d >>> 20) + a << 0;
329
- c += (b ^ d & (a ^ b)) + blocks2[14] - 1502002290;
330
- c = (c << 17 | c >>> 15) + d << 0;
331
- b += (a ^ c & (d ^ a)) + blocks2[15] + 1236535329;
332
- b = (b << 22 | b >>> 10) + c << 0;
333
- a += (c ^ d & (b ^ c)) + blocks2[1] - 165796510;
334
- a = (a << 5 | a >>> 27) + b << 0;
335
- d += (b ^ c & (a ^ b)) + blocks2[6] - 1069501632;
336
- d = (d << 9 | d >>> 23) + a << 0;
337
- c += (a ^ b & (d ^ a)) + blocks2[11] + 643717713;
338
- c = (c << 14 | c >>> 18) + d << 0;
339
- b += (d ^ a & (c ^ d)) + blocks2[0] - 373897302;
340
- b = (b << 20 | b >>> 12) + c << 0;
341
- a += (c ^ d & (b ^ c)) + blocks2[5] - 701558691;
342
- a = (a << 5 | a >>> 27) + b << 0;
343
- d += (b ^ c & (a ^ b)) + blocks2[10] + 38016083;
344
- d = (d << 9 | d >>> 23) + a << 0;
345
- c += (a ^ b & (d ^ a)) + blocks2[15] - 660478335;
346
- c = (c << 14 | c >>> 18) + d << 0;
347
- b += (d ^ a & (c ^ d)) + blocks2[4] - 405537848;
348
- b = (b << 20 | b >>> 12) + c << 0;
349
- a += (c ^ d & (b ^ c)) + blocks2[9] + 568446438;
350
- a = (a << 5 | a >>> 27) + b << 0;
351
- d += (b ^ c & (a ^ b)) + blocks2[14] - 1019803690;
352
- d = (d << 9 | d >>> 23) + a << 0;
353
- c += (a ^ b & (d ^ a)) + blocks2[3] - 187363961;
354
- c = (c << 14 | c >>> 18) + d << 0;
355
- b += (d ^ a & (c ^ d)) + blocks2[8] + 1163531501;
356
- b = (b << 20 | b >>> 12) + c << 0;
357
- a += (c ^ d & (b ^ c)) + blocks2[13] - 1444681467;
358
- a = (a << 5 | a >>> 27) + b << 0;
359
- d += (b ^ c & (a ^ b)) + blocks2[2] - 51403784;
360
- d = (d << 9 | d >>> 23) + a << 0;
361
- c += (a ^ b & (d ^ a)) + blocks2[7] + 1735328473;
362
- c = (c << 14 | c >>> 18) + d << 0;
363
- b += (d ^ a & (c ^ d)) + blocks2[12] - 1926607734;
364
- b = (b << 20 | b >>> 12) + c << 0;
365
- bc = b ^ c;
366
- a += (bc ^ d) + blocks2[5] - 378558;
367
- a = (a << 4 | a >>> 28) + b << 0;
368
- d += (bc ^ a) + blocks2[8] - 2022574463;
369
- d = (d << 11 | d >>> 21) + a << 0;
370
- da = d ^ a;
371
- c += (da ^ b) + blocks2[11] + 1839030562;
372
- c = (c << 16 | c >>> 16) + d << 0;
373
- b += (da ^ c) + blocks2[14] - 35309556;
374
- b = (b << 23 | b >>> 9) + c << 0;
375
- bc = b ^ c;
376
- a += (bc ^ d) + blocks2[1] - 1530992060;
377
- a = (a << 4 | a >>> 28) + b << 0;
378
- d += (bc ^ a) + blocks2[4] + 1272893353;
379
- d = (d << 11 | d >>> 21) + a << 0;
380
- da = d ^ a;
381
- c += (da ^ b) + blocks2[7] - 155497632;
382
- c = (c << 16 | c >>> 16) + d << 0;
383
- b += (da ^ c) + blocks2[10] - 1094730640;
384
- b = (b << 23 | b >>> 9) + c << 0;
385
- bc = b ^ c;
386
- a += (bc ^ d) + blocks2[13] + 681279174;
387
- a = (a << 4 | a >>> 28) + b << 0;
388
- d += (bc ^ a) + blocks2[0] - 358537222;
389
- d = (d << 11 | d >>> 21) + a << 0;
390
- da = d ^ a;
391
- c += (da ^ b) + blocks2[3] - 722521979;
392
- c = (c << 16 | c >>> 16) + d << 0;
393
- b += (da ^ c) + blocks2[6] + 76029189;
394
- b = (b << 23 | b >>> 9) + c << 0;
395
- bc = b ^ c;
396
- a += (bc ^ d) + blocks2[9] - 640364487;
397
- a = (a << 4 | a >>> 28) + b << 0;
398
- d += (bc ^ a) + blocks2[12] - 421815835;
399
- d = (d << 11 | d >>> 21) + a << 0;
400
- da = d ^ a;
401
- c += (da ^ b) + blocks2[15] + 530742520;
402
- c = (c << 16 | c >>> 16) + d << 0;
403
- b += (da ^ c) + blocks2[2] - 995338651;
404
- b = (b << 23 | b >>> 9) + c << 0;
405
- a += (c ^ (b | ~d)) + blocks2[0] - 198630844;
406
- a = (a << 6 | a >>> 26) + b << 0;
407
- d += (b ^ (a | ~c)) + blocks2[7] + 1126891415;
408
- d = (d << 10 | d >>> 22) + a << 0;
409
- c += (a ^ (d | ~b)) + blocks2[14] - 1416354905;
410
- c = (c << 15 | c >>> 17) + d << 0;
411
- b += (d ^ (c | ~a)) + blocks2[5] - 57434055;
412
- b = (b << 21 | b >>> 11) + c << 0;
413
- a += (c ^ (b | ~d)) + blocks2[12] + 1700485571;
414
- a = (a << 6 | a >>> 26) + b << 0;
415
- d += (b ^ (a | ~c)) + blocks2[3] - 1894986606;
416
- d = (d << 10 | d >>> 22) + a << 0;
417
- c += (a ^ (d | ~b)) + blocks2[10] - 1051523;
418
- c = (c << 15 | c >>> 17) + d << 0;
419
- b += (d ^ (c | ~a)) + blocks2[1] - 2054922799;
420
- b = (b << 21 | b >>> 11) + c << 0;
421
- a += (c ^ (b | ~d)) + blocks2[8] + 1873313359;
422
- a = (a << 6 | a >>> 26) + b << 0;
423
- d += (b ^ (a | ~c)) + blocks2[15] - 30611744;
424
- d = (d << 10 | d >>> 22) + a << 0;
425
- c += (a ^ (d | ~b)) + blocks2[6] - 1560198380;
426
- c = (c << 15 | c >>> 17) + d << 0;
427
- b += (d ^ (c | ~a)) + blocks2[13] + 1309151649;
428
- b = (b << 21 | b >>> 11) + c << 0;
429
- a += (c ^ (b | ~d)) + blocks2[4] - 145523070;
430
- a = (a << 6 | a >>> 26) + b << 0;
431
- d += (b ^ (a | ~c)) + blocks2[11] - 1120210379;
432
- d = (d << 10 | d >>> 22) + a << 0;
433
- c += (a ^ (d | ~b)) + blocks2[2] + 718787259;
434
- c = (c << 15 | c >>> 17) + d << 0;
435
- b += (d ^ (c | ~a)) + blocks2[9] - 343485551;
436
- b = (b << 21 | b >>> 11) + c << 0;
437
- if (this.first) {
438
- this.h0 = a + 1732584193 << 0;
439
- this.h1 = b - 271733879 << 0;
440
- this.h2 = c - 1732584194 << 0;
441
- this.h3 = d + 271733878 << 0;
442
- this.first = false;
443
- } else {
444
- this.h0 = this.h0 + a << 0;
445
- this.h1 = this.h1 + b << 0;
446
- this.h2 = this.h2 + c << 0;
447
- this.h3 = this.h3 + d << 0;
448
- }
449
- };
450
- Md5.prototype.hex = function() {
451
- this.finalize();
452
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
453
- return HEX_CHARS[h0 >>> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h0 >>> 12 & 15] + HEX_CHARS[h0 >>> 8 & 15] + HEX_CHARS[h0 >>> 20 & 15] + HEX_CHARS[h0 >>> 16 & 15] + HEX_CHARS[h0 >>> 28 & 15] + HEX_CHARS[h0 >>> 24 & 15] + HEX_CHARS[h1 >>> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h1 >>> 12 & 15] + HEX_CHARS[h1 >>> 8 & 15] + HEX_CHARS[h1 >>> 20 & 15] + HEX_CHARS[h1 >>> 16 & 15] + HEX_CHARS[h1 >>> 28 & 15] + HEX_CHARS[h1 >>> 24 & 15] + HEX_CHARS[h2 >>> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h2 >>> 12 & 15] + HEX_CHARS[h2 >>> 8 & 15] + HEX_CHARS[h2 >>> 20 & 15] + HEX_CHARS[h2 >>> 16 & 15] + HEX_CHARS[h2 >>> 28 & 15] + HEX_CHARS[h2 >>> 24 & 15] + HEX_CHARS[h3 >>> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h3 >>> 12 & 15] + HEX_CHARS[h3 >>> 8 & 15] + HEX_CHARS[h3 >>> 20 & 15] + HEX_CHARS[h3 >>> 16 & 15] + HEX_CHARS[h3 >>> 28 & 15] + HEX_CHARS[h3 >>> 24 & 15];
454
- };
455
- Md5.prototype.toString = Md5.prototype.hex;
456
- Md5.prototype.digest = function() {
457
- this.finalize();
458
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
459
- return [
460
- h0 & 255,
461
- h0 >>> 8 & 255,
462
- h0 >>> 16 & 255,
463
- h0 >>> 24 & 255,
464
- h1 & 255,
465
- h1 >>> 8 & 255,
466
- h1 >>> 16 & 255,
467
- h1 >>> 24 & 255,
468
- h2 & 255,
469
- h2 >>> 8 & 255,
470
- h2 >>> 16 & 255,
471
- h2 >>> 24 & 255,
472
- h3 & 255,
473
- h3 >>> 8 & 255,
474
- h3 >>> 16 & 255,
475
- h3 >>> 24 & 255
476
- ];
477
- };
478
- Md5.prototype.array = Md5.prototype.digest;
479
- Md5.prototype.arrayBuffer = function() {
480
- this.finalize();
481
- var buffer2 = new ArrayBuffer(16);
482
- var blocks2 = new Uint32Array(buffer2);
483
- blocks2[0] = this.h0;
484
- blocks2[1] = this.h1;
485
- blocks2[2] = this.h2;
486
- blocks2[3] = this.h3;
487
- return buffer2;
488
- };
489
- Md5.prototype.buffer = Md5.prototype.arrayBuffer;
490
- Md5.prototype.base64 = function() {
491
- var v1, v2, v3, base64Str = "", bytes = this.array();
492
- for (var i = 0; i < 15; ) {
493
- v1 = bytes[i++];
494
- v2 = bytes[i++];
495
- v3 = bytes[i++];
496
- base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] + BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] + BASE64_ENCODE_CHAR[v3 & 63];
497
- }
498
- v1 = bytes[i];
499
- base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[v1 << 4 & 63] + "==";
500
- return base64Str;
501
- };
502
- function HmacMd5(key, sharedMemory) {
503
- var i, result = formatMessage(key);
504
- key = result[0];
505
- if (result[1]) {
506
- var bytes = [], length = key.length, index = 0, code;
507
- for (i = 0; i < length; ++i) {
508
- code = key.charCodeAt(i);
509
- if (code < 128) {
510
- bytes[index++] = code;
511
- } else if (code < 2048) {
512
- bytes[index++] = 192 | code >>> 6;
513
- bytes[index++] = 128 | code & 63;
514
- } else if (code < 55296 || code >= 57344) {
515
- bytes[index++] = 224 | code >>> 12;
516
- bytes[index++] = 128 | code >>> 6 & 63;
517
- bytes[index++] = 128 | code & 63;
518
- } else {
519
- code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
520
- bytes[index++] = 240 | code >>> 18;
521
- bytes[index++] = 128 | code >>> 12 & 63;
522
- bytes[index++] = 128 | code >>> 6 & 63;
523
- bytes[index++] = 128 | code & 63;
524
- }
525
- }
526
- key = bytes;
527
- }
528
- if (key.length > 64) {
529
- key = new Md5(true).update(key).array();
530
- }
531
- var oKeyPad = [], iKeyPad = [];
532
- for (i = 0; i < 64; ++i) {
533
- var b = key[i] || 0;
534
- oKeyPad[i] = 92 ^ b;
535
- iKeyPad[i] = 54 ^ b;
536
- }
537
- Md5.call(this, sharedMemory);
538
- this.update(iKeyPad);
539
- this.oKeyPad = oKeyPad;
540
- this.inner = true;
541
- this.sharedMemory = sharedMemory;
542
- }
543
- HmacMd5.prototype = new Md5();
544
- HmacMd5.prototype.finalize = function() {
545
- Md5.prototype.finalize.call(this);
546
- if (this.inner) {
547
- this.inner = false;
548
- var innerHash = this.array();
549
- Md5.call(this, this.sharedMemory);
550
- this.update(this.oKeyPad);
551
- this.update(innerHash);
552
- Md5.prototype.finalize.call(this);
553
- }
554
- };
555
- var exports2 = createMethod();
556
- exports2.md5 = exports2;
557
- exports2.md5.hmac = createHmacMethod();
558
- if (COMMON_JS) {
559
- module.exports = exports2;
560
- } else {
561
- root.md5 = exports2;
562
- if (AMD) {
563
- define(function() {
564
- return exports2;
565
- });
566
- }
567
- }
568
- })();
569
- }
570
- });
571
-
572
1
  // src/fingerprint/defaults.ts
573
2
  var DEFAULT_MODE = "balanced";
574
3
  var DEFAULT_COLLECT_FLAGS = {
@@ -615,10 +44,18 @@ function resolvePerformance(options) {
615
44
  }
616
45
 
617
46
  // src/utils/collectUserData.ts
618
- var import_js_md5 = __toESM(require_md5(), 1);
619
47
  function item(category, key, label, value) {
620
48
  return { category, key, label, value: String(value ?? "\u2014") };
621
49
  }
50
+ function hashStringHex(input) {
51
+ let hash = 2166136261;
52
+ for (let i = 0; i < input.length; i += 1) {
53
+ hash ^= input.charCodeAt(i);
54
+ hash = Math.imul(hash, 16777619);
55
+ }
56
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
57
+ return `${part}${part}${part}${part}`;
58
+ }
622
59
  function getWebGLInfo() {
623
60
  var _a;
624
61
  try {
@@ -682,7 +119,7 @@ function getCanvasFingerprint() {
682
119
  ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
683
120
  ctx.fillText(txt, 4, 17);
684
121
  const dataUrl = c.toDataURL("image/png");
685
- return (0, import_js_md5.md5)(dataUrl).toUpperCase();
122
+ return hashStringHex(dataUrl);
686
123
  } catch {
687
124
  return "\u2014";
688
125
  }
@@ -1392,18 +829,29 @@ function gatherQuickSignals(options) {
1392
829
  }
1393
830
 
1394
831
  // src/fingerprint/hash.ts
1395
- var import_js_md52 = __toESM(require_md5(), 1);
1396
832
  function toHex(buffer) {
1397
833
  const bytes = new Uint8Array(buffer);
1398
834
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
1399
835
  }
1400
836
  async function createDigest(payload, algorithm = "SHA-256") {
1401
837
  if (algorithm === "MD5") {
1402
- return (0, import_js_md52.md5)(payload).toUpperCase();
838
+ let hash = 2166136261;
839
+ for (let i = 0; i < payload.length; i += 1) {
840
+ hash ^= payload.charCodeAt(i);
841
+ hash = Math.imul(hash, 16777619);
842
+ }
843
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
844
+ return `${part}${part}${part}${part}`;
1403
845
  }
1404
846
  const cryptoApi = globalThis.crypto;
1405
847
  if (!(cryptoApi == null ? void 0 : cryptoApi.subtle)) {
1406
- return (0, import_js_md52.md5)(payload).toUpperCase();
848
+ let hash = 2166136261;
849
+ for (let i = 0; i < payload.length; i += 1) {
850
+ hash ^= payload.charCodeAt(i);
851
+ hash = Math.imul(hash, 16777619);
852
+ }
853
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
854
+ return `${part}${part}${part}${part}`;
1407
855
  }
1408
856
  const encoded = new TextEncoder().encode(payload);
1409
857
  const digest = await cryptoApi.subtle.digest("SHA-256", encoded);
@@ -1465,6 +913,20 @@ var VOLATILE_DEVICE_KEYS = /* @__PURE__ */ new Set([
1465
913
  "screenLeft",
1466
914
  "screenTop"
1467
915
  ]);
916
+ var HARDWARE_DEVICE_KEYS = /* @__PURE__ */ new Set([
917
+ "hardwareConcurrency",
918
+ "deviceMemory",
919
+ "platform",
920
+ "unmaskedVendor",
921
+ "unmaskedRenderer",
922
+ "width",
923
+ "height",
924
+ "colorDepth",
925
+ "pixelDepth",
926
+ "timeZone",
927
+ "sampleRate",
928
+ "maxTouchPoints"
929
+ ]);
1468
930
  function getSignalStability(key) {
1469
931
  if (STABLE_DEVICE_KEYS.has(key)) {
1470
932
  return "stable";
@@ -1523,6 +985,16 @@ function toCoreCanonicalPayload(components) {
1523
985
  return false;
1524
986
  }).map((component) => `${component.key}=${component.value}`).join("|");
1525
987
  }
988
+ function toHardwareCanonicalPayload(components) {
989
+ return components.filter((component) => {
990
+ if (component.kind === "required" && component.key === "required.merchantId") return true;
991
+ if (component.kind === "device") {
992
+ const key = component.key.replace(/^device\./, "");
993
+ return HARDWARE_DEVICE_KEYS.has(key);
994
+ }
995
+ return false;
996
+ }).map((component) => `${component.key}=${component.value}`).join("|");
997
+ }
1526
998
  function computeConfidenceScore(components, timedOutCollectors, failedCollectorsCount) {
1527
999
  const weightedTotal = components.reduce((total, component) => total + component.weight, 0);
1528
1000
  if (weightedTotal === 0) {
@@ -1572,10 +1044,12 @@ async function getFingerprint(options) {
1572
1044
  deviceSignals: gathered.deviceSignals
1573
1045
  });
1574
1046
  const corePayload = toCoreCanonicalPayload(components);
1047
+ const hardwarePayload = toHardwareCanonicalPayload(components);
1575
1048
  const fullPayload = toCanonicalPayload(components);
1576
1049
  const digestAlgorithm = ((_a = options.hash) == null ? void 0 : _a.algorithm) ?? "SHA-256";
1577
- const [coreHash, fullHash] = await Promise.all([
1050
+ const [coreHash, hardwareCoreHash, fullHash] = await Promise.all([
1578
1051
  createDigest(corePayload, digestAlgorithm),
1052
+ createDigest(hardwarePayload, digestAlgorithm),
1579
1053
  createDigest(fullPayload, digestAlgorithm)
1580
1054
  ]);
1581
1055
  const completedAtMs = Date.now();
@@ -1583,6 +1057,7 @@ async function getFingerprint(options) {
1583
1057
  const maskedRaw = applyPrivacy(gathered.rawItems, ((_c = options.privacy) == null ? void 0 : _c.maskSensitive) ?? false);
1584
1058
  return {
1585
1059
  coreHash,
1060
+ hardwareCoreHash,
1586
1061
  fullHash,
1587
1062
  hash: fullHash,
1588
1063
  hashVersion: "fp_v1",
@@ -1623,10 +1098,12 @@ async function getFingerprintQuick(options) {
1623
1098
  deviceSignals: gathered.deviceSignals
1624
1099
  });
1625
1100
  const corePayload = toCoreCanonicalPayload(components);
1101
+ const hardwarePayload = toHardwareCanonicalPayload(components);
1626
1102
  const fullPayload = toCanonicalPayload(components);
1627
1103
  const digestAlgorithm = ((_a = options.hash) == null ? void 0 : _a.algorithm) ?? "SHA-256";
1628
- const [coreHash, fullHash] = await Promise.all([
1104
+ const [coreHash, hardwareCoreHash, fullHash] = await Promise.all([
1629
1105
  createDigest(corePayload, digestAlgorithm),
1106
+ createDigest(hardwarePayload, digestAlgorithm),
1630
1107
  createDigest(fullPayload, digestAlgorithm)
1631
1108
  ]);
1632
1109
  const completedAtMs = Date.now();
@@ -1634,6 +1111,7 @@ async function getFingerprintQuick(options) {
1634
1111
  const maskedRaw = applyPrivacy(gathered.rawItems, ((_c = options.privacy) == null ? void 0 : _c.maskSensitive) ?? false);
1635
1112
  return {
1636
1113
  coreHash,
1114
+ hardwareCoreHash,
1637
1115
  fullHash,
1638
1116
  hash: fullHash,
1639
1117
  hashVersion: "fp_v1",
@@ -1719,8 +1197,9 @@ function compareFingerprints(current, reference) {
1719
1197
  if (refComponent.stability === "volatile") changedVolatileKeys.push(refComponent.key);
1720
1198
  }
1721
1199
  const similarityScore = totalReferenceWeight === 0 ? 0 : round3(matchedWeight / totalReferenceWeight);
1200
+ const crossBrowserSimilarityScore = current.hardwareCoreHash === reference.hardwareCoreHash ? Math.max(similarityScore, 0.9) : similarityScore;
1722
1201
  const reasons = [];
1723
- let risk = 1 - similarityScore;
1202
+ let risk = 1 - crossBrowserSimilarityScore;
1724
1203
  if (changedStableKeys.length >= 3) {
1725
1204
  risk += 0.2;
1726
1205
  reasons.push("Multiple stable identifiers changed");
@@ -1763,13 +1242,15 @@ function compareFingerprints(current, reference) {
1763
1242
  const riskScore = round3(risk);
1764
1243
  let verdict = "different_device";
1765
1244
  if (similarityScore >= 0.85 && riskScore < 0.35) verdict = "same_device";
1245
+ else if (crossBrowserSimilarityScore >= 0.82 && riskScore < 0.45) verdict = "likely_same_cross_browser";
1766
1246
  else if (similarityScore >= 0.7 && riskScore < 0.55) verdict = "likely_same";
1767
- else if (similarityScore >= 0.45) verdict = "suspicious";
1247
+ else if (crossBrowserSimilarityScore >= 0.45) verdict = "suspicious";
1768
1248
  if (!reasons.length) {
1769
1249
  reasons.push("No meaningful drift between profiles");
1770
1250
  }
1771
1251
  return {
1772
1252
  similarityScore,
1253
+ crossBrowserSimilarityScore,
1773
1254
  riskScore,
1774
1255
  verdict,
1775
1256
  matchedWeight,
@@ -1784,13 +1265,13 @@ function buildIdentityId(profile) {
1784
1265
  }
1785
1266
  function compareFingerprintAgainstHistory(current, history2) {
1786
1267
  if (!history2.length) {
1787
- const self2 = compareFingerprints(current, current);
1268
+ const self = compareFingerprints(current, current);
1788
1269
  return {
1789
- best: self2,
1270
+ best: self,
1790
1271
  bestIndex: -1,
1791
1272
  comparedCount: 0,
1792
- aggregateRiskScore: self2.riskScore,
1793
- aggregateSimilarityScore: self2.similarityScore
1273
+ aggregateRiskScore: self.riskScore,
1274
+ aggregateSimilarityScore: self.similarityScore
1794
1275
  };
1795
1276
  }
1796
1277
  const comparisons = history2.map((entry) => compareFingerprints(current, entry));
@@ -1917,7 +1398,10 @@ function assessPaymentRisk(input) {
1917
1398
  var _a, _b, _c, _d;
1918
1399
  const reasons = [...input.comparison.reasons];
1919
1400
  let score = input.comparison.riskScore;
1920
- const similarityScore = input.comparison.similarityScore;
1401
+ const effectiveSimilarity = Math.max(
1402
+ input.comparison.similarityScore,
1403
+ input.comparison.crossBrowserSimilarityScore
1404
+ );
1921
1405
  if (input.history) {
1922
1406
  if (input.history.aggregateRiskScore > 0.6) {
1923
1407
  score += 0.1;
@@ -1947,14 +1431,14 @@ function assessPaymentRisk(input) {
1947
1431
  }
1948
1432
  const finalScore = Math.max(0, Math.min(1, Number(score.toFixed(3))));
1949
1433
  let decision = "manual_review";
1950
- if (finalScore < 0.35 && similarityScore >= 0.82) decision = "allow";
1951
- else if (finalScore < 0.55 && similarityScore >= 0.65) decision = "challenge";
1952
- else if (finalScore >= 0.8 || similarityScore < 0.35) decision = "deny";
1434
+ if (finalScore < 0.35 && effectiveSimilarity >= 0.82) decision = "allow";
1435
+ else if (finalScore < 0.55 && effectiveSimilarity >= 0.65) decision = "challenge";
1436
+ else if (finalScore >= 0.8 || effectiveSimilarity < 0.35) decision = "deny";
1953
1437
  const output = {
1954
1438
  decision,
1955
1439
  score: finalScore,
1956
1440
  reasons: Array.from(new Set(reasons)),
1957
- similarityScore,
1441
+ similarityScore: effectiveSimilarity,
1958
1442
  riskScore: input.comparison.riskScore
1959
1443
  };
1960
1444
  fetch("http://127.0.0.1:7417/ingest/67545057-d930-4022-a3c5-818008410ad2", { method: "POST", headers: { "Content-Type": "application/json", "X-Debug-Session-Id": "ce1cd9" }, body: JSON.stringify({ sessionId: "ce1cd9", runId: "payment-risk", hypothesisId: "H4", location: "src/fingerprint/payment.ts:assessPaymentRisk", message: "payment risk assessed", data: { decision: output.decision, score: output.score, similarity: output.similarityScore, risk: output.riskScore, reasonsCount: output.reasons.length }, timestamp: Date.now() }) }).catch(() => {
@@ -1985,16 +1469,3 @@ export {
1985
1469
  resolveFingerprintPerformance,
1986
1470
  startPaymentFingerprintSession
1987
1471
  };
1988
- /*! Bundled license information:
1989
-
1990
- js-md5/src/md5.js:
1991
- (**
1992
- * [js-md5]{@link https://github.com/emn178/js-md5}
1993
- *
1994
- * @namespace md5
1995
- * @version 0.8.3
1996
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
1997
- * @copyright Chen, Yi-Cyuan 2014-2023
1998
- * @license MIT
1999
- *)
2000
- */