@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.cjs CHANGED
@@ -1,12 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
5
  var __export = (target, all) => {
11
6
  for (var name in all)
12
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -19,555 +14,8 @@ var __copyProps = (to, from, except, desc) => {
19
14
  }
20
15
  return to;
21
16
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
18
 
32
- // node_modules/js-md5/src/md5.js
33
- var require_md5 = __commonJS({
34
- "node_modules/js-md5/src/md5.js"(exports2, module2) {
35
- (function() {
36
- "use strict";
37
- var INPUT_ERROR = "input is invalid type";
38
- var FINALIZE_ERROR = "finalize already called";
39
- var WINDOW = typeof window === "object";
40
- var root = WINDOW ? window : {};
41
- if (root.JS_MD5_NO_WINDOW) {
42
- WINDOW = false;
43
- }
44
- var WEB_WORKER = !WINDOW && typeof self === "object";
45
- var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node;
46
- if (NODE_JS) {
47
- root = global;
48
- } else if (WEB_WORKER) {
49
- root = self;
50
- }
51
- var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module2 === "object" && module2.exports;
52
- var AMD = typeof define === "function" && define.amd;
53
- var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
54
- var HEX_CHARS = "0123456789abcdef".split("");
55
- var EXTRA = [128, 32768, 8388608, -2147483648];
56
- var SHIFT = [0, 8, 16, 24];
57
- var OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"];
58
- var BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
59
- var blocks = [], buffer8;
60
- if (ARRAY_BUFFER) {
61
- var buffer = new ArrayBuffer(68);
62
- buffer8 = new Uint8Array(buffer);
63
- blocks = new Uint32Array(buffer);
64
- }
65
- var isArray = Array.isArray;
66
- if (root.JS_MD5_NO_NODE_JS || !isArray) {
67
- isArray = function(obj) {
68
- return Object.prototype.toString.call(obj) === "[object Array]";
69
- };
70
- }
71
- var isView = ArrayBuffer.isView;
72
- if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !isView)) {
73
- isView = function(obj) {
74
- return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
75
- };
76
- }
77
- var formatMessage = function(message) {
78
- var type = typeof message;
79
- if (type === "string") {
80
- return [message, true];
81
- }
82
- if (type !== "object" || message === null) {
83
- throw new Error(INPUT_ERROR);
84
- }
85
- if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
86
- return [new Uint8Array(message), false];
87
- }
88
- if (!isArray(message) && !isView(message)) {
89
- throw new Error(INPUT_ERROR);
90
- }
91
- return [message, false];
92
- };
93
- var createOutputMethod = function(outputType) {
94
- return function(message) {
95
- return new Md5(true).update(message)[outputType]();
96
- };
97
- };
98
- var createMethod = function() {
99
- var method = createOutputMethod("hex");
100
- if (NODE_JS) {
101
- method = nodeWrap(method);
102
- }
103
- method.create = function() {
104
- return new Md5();
105
- };
106
- method.update = function(message) {
107
- return method.create().update(message);
108
- };
109
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
110
- var type = OUTPUT_TYPES[i];
111
- method[type] = createOutputMethod(type);
112
- }
113
- return method;
114
- };
115
- var nodeWrap = function(method) {
116
- var crypto2 = require("crypto");
117
- var Buffer2 = require("buffer").Buffer;
118
- var bufferFrom;
119
- if (Buffer2.from && !root.JS_MD5_NO_BUFFER_FROM) {
120
- bufferFrom = Buffer2.from;
121
- } else {
122
- bufferFrom = function(message) {
123
- return new Buffer2(message);
124
- };
125
- }
126
- var nodeMethod = function(message) {
127
- if (typeof message === "string") {
128
- return crypto2.createHash("md5").update(message, "utf8").digest("hex");
129
- } else {
130
- if (message === null || message === void 0) {
131
- throw new Error(INPUT_ERROR);
132
- } else if (message.constructor === ArrayBuffer) {
133
- message = new Uint8Array(message);
134
- }
135
- }
136
- if (isArray(message) || isView(message) || message.constructor === Buffer2) {
137
- return crypto2.createHash("md5").update(bufferFrom(message)).digest("hex");
138
- } else {
139
- return method(message);
140
- }
141
- };
142
- return nodeMethod;
143
- };
144
- var createHmacOutputMethod = function(outputType) {
145
- return function(key, message) {
146
- return new HmacMd5(key, true).update(message)[outputType]();
147
- };
148
- };
149
- var createHmacMethod = function() {
150
- var method = createHmacOutputMethod("hex");
151
- method.create = function(key) {
152
- return new HmacMd5(key);
153
- };
154
- method.update = function(key, message) {
155
- return method.create(key).update(message);
156
- };
157
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
158
- var type = OUTPUT_TYPES[i];
159
- method[type] = createHmacOutputMethod(type);
160
- }
161
- return method;
162
- };
163
- function Md5(sharedMemory) {
164
- if (sharedMemory) {
165
- 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;
166
- this.blocks = blocks;
167
- this.buffer8 = buffer8;
168
- } else {
169
- if (ARRAY_BUFFER) {
170
- var buffer2 = new ArrayBuffer(68);
171
- this.buffer8 = new Uint8Array(buffer2);
172
- this.blocks = new Uint32Array(buffer2);
173
- } else {
174
- this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
175
- }
176
- }
177
- this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
178
- this.finalized = this.hashed = false;
179
- this.first = true;
180
- }
181
- Md5.prototype.update = function(message) {
182
- if (this.finalized) {
183
- throw new Error(FINALIZE_ERROR);
184
- }
185
- var result = formatMessage(message);
186
- message = result[0];
187
- var isString = result[1];
188
- var code, index = 0, i, length = message.length, blocks2 = this.blocks;
189
- var buffer82 = this.buffer8;
190
- while (index < length) {
191
- if (this.hashed) {
192
- this.hashed = false;
193
- blocks2[0] = blocks2[16];
194
- 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;
195
- }
196
- if (isString) {
197
- if (ARRAY_BUFFER) {
198
- for (i = this.start; index < length && i < 64; ++index) {
199
- code = message.charCodeAt(index);
200
- if (code < 128) {
201
- buffer82[i++] = code;
202
- } else if (code < 2048) {
203
- buffer82[i++] = 192 | code >>> 6;
204
- buffer82[i++] = 128 | code & 63;
205
- } else if (code < 55296 || code >= 57344) {
206
- buffer82[i++] = 224 | code >>> 12;
207
- buffer82[i++] = 128 | code >>> 6 & 63;
208
- buffer82[i++] = 128 | code & 63;
209
- } else {
210
- code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
211
- buffer82[i++] = 240 | code >>> 18;
212
- buffer82[i++] = 128 | code >>> 12 & 63;
213
- buffer82[i++] = 128 | code >>> 6 & 63;
214
- buffer82[i++] = 128 | code & 63;
215
- }
216
- }
217
- } else {
218
- for (i = this.start; index < length && i < 64; ++index) {
219
- code = message.charCodeAt(index);
220
- if (code < 128) {
221
- blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
222
- } else if (code < 2048) {
223
- blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
224
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
225
- } else if (code < 55296 || code >= 57344) {
226
- blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
227
- blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
228
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
229
- } else {
230
- code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
231
- blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
232
- blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
233
- blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
234
- blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
235
- }
236
- }
237
- }
238
- } else {
239
- if (ARRAY_BUFFER) {
240
- for (i = this.start; index < length && i < 64; ++index) {
241
- buffer82[i++] = message[index];
242
- }
243
- } else {
244
- for (i = this.start; index < length && i < 64; ++index) {
245
- blocks2[i >>> 2] |= message[index] << SHIFT[i++ & 3];
246
- }
247
- }
248
- }
249
- this.lastByteIndex = i;
250
- this.bytes += i - this.start;
251
- if (i >= 64) {
252
- this.start = i - 64;
253
- this.hash();
254
- this.hashed = true;
255
- } else {
256
- this.start = i;
257
- }
258
- }
259
- if (this.bytes > 4294967295) {
260
- this.hBytes += this.bytes / 4294967296 << 0;
261
- this.bytes = this.bytes % 4294967296;
262
- }
263
- return this;
264
- };
265
- Md5.prototype.finalize = function() {
266
- if (this.finalized) {
267
- return;
268
- }
269
- this.finalized = true;
270
- var blocks2 = this.blocks, i = this.lastByteIndex;
271
- blocks2[i >>> 2] |= EXTRA[i & 3];
272
- if (i >= 56) {
273
- if (!this.hashed) {
274
- this.hash();
275
- }
276
- blocks2[0] = blocks2[16];
277
- 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;
278
- }
279
- blocks2[14] = this.bytes << 3;
280
- blocks2[15] = this.hBytes << 3 | this.bytes >>> 29;
281
- this.hash();
282
- };
283
- Md5.prototype.hash = function() {
284
- var a, b, c, d, bc, da, blocks2 = this.blocks;
285
- if (this.first) {
286
- a = blocks2[0] - 680876937;
287
- a = (a << 7 | a >>> 25) - 271733879 << 0;
288
- d = (-1732584194 ^ a & 2004318071) + blocks2[1] - 117830708;
289
- d = (d << 12 | d >>> 20) + a << 0;
290
- c = (-271733879 ^ d & (a ^ -271733879)) + blocks2[2] - 1126478375;
291
- c = (c << 17 | c >>> 15) + d << 0;
292
- b = (a ^ c & (d ^ a)) + blocks2[3] - 1316259209;
293
- b = (b << 22 | b >>> 10) + c << 0;
294
- } else {
295
- a = this.h0;
296
- b = this.h1;
297
- c = this.h2;
298
- d = this.h3;
299
- a += (d ^ b & (c ^ d)) + blocks2[0] - 680876936;
300
- a = (a << 7 | a >>> 25) + b << 0;
301
- d += (c ^ a & (b ^ c)) + blocks2[1] - 389564586;
302
- d = (d << 12 | d >>> 20) + a << 0;
303
- c += (b ^ d & (a ^ b)) + blocks2[2] + 606105819;
304
- c = (c << 17 | c >>> 15) + d << 0;
305
- b += (a ^ c & (d ^ a)) + blocks2[3] - 1044525330;
306
- b = (b << 22 | b >>> 10) + c << 0;
307
- }
308
- a += (d ^ b & (c ^ d)) + blocks2[4] - 176418897;
309
- a = (a << 7 | a >>> 25) + b << 0;
310
- d += (c ^ a & (b ^ c)) + blocks2[5] + 1200080426;
311
- d = (d << 12 | d >>> 20) + a << 0;
312
- c += (b ^ d & (a ^ b)) + blocks2[6] - 1473231341;
313
- c = (c << 17 | c >>> 15) + d << 0;
314
- b += (a ^ c & (d ^ a)) + blocks2[7] - 45705983;
315
- b = (b << 22 | b >>> 10) + c << 0;
316
- a += (d ^ b & (c ^ d)) + blocks2[8] + 1770035416;
317
- a = (a << 7 | a >>> 25) + b << 0;
318
- d += (c ^ a & (b ^ c)) + blocks2[9] - 1958414417;
319
- d = (d << 12 | d >>> 20) + a << 0;
320
- c += (b ^ d & (a ^ b)) + blocks2[10] - 42063;
321
- c = (c << 17 | c >>> 15) + d << 0;
322
- b += (a ^ c & (d ^ a)) + blocks2[11] - 1990404162;
323
- b = (b << 22 | b >>> 10) + c << 0;
324
- a += (d ^ b & (c ^ d)) + blocks2[12] + 1804603682;
325
- a = (a << 7 | a >>> 25) + b << 0;
326
- d += (c ^ a & (b ^ c)) + blocks2[13] - 40341101;
327
- d = (d << 12 | d >>> 20) + a << 0;
328
- c += (b ^ d & (a ^ b)) + blocks2[14] - 1502002290;
329
- c = (c << 17 | c >>> 15) + d << 0;
330
- b += (a ^ c & (d ^ a)) + blocks2[15] + 1236535329;
331
- b = (b << 22 | b >>> 10) + c << 0;
332
- a += (c ^ d & (b ^ c)) + blocks2[1] - 165796510;
333
- a = (a << 5 | a >>> 27) + b << 0;
334
- d += (b ^ c & (a ^ b)) + blocks2[6] - 1069501632;
335
- d = (d << 9 | d >>> 23) + a << 0;
336
- c += (a ^ b & (d ^ a)) + blocks2[11] + 643717713;
337
- c = (c << 14 | c >>> 18) + d << 0;
338
- b += (d ^ a & (c ^ d)) + blocks2[0] - 373897302;
339
- b = (b << 20 | b >>> 12) + c << 0;
340
- a += (c ^ d & (b ^ c)) + blocks2[5] - 701558691;
341
- a = (a << 5 | a >>> 27) + b << 0;
342
- d += (b ^ c & (a ^ b)) + blocks2[10] + 38016083;
343
- d = (d << 9 | d >>> 23) + a << 0;
344
- c += (a ^ b & (d ^ a)) + blocks2[15] - 660478335;
345
- c = (c << 14 | c >>> 18) + d << 0;
346
- b += (d ^ a & (c ^ d)) + blocks2[4] - 405537848;
347
- b = (b << 20 | b >>> 12) + c << 0;
348
- a += (c ^ d & (b ^ c)) + blocks2[9] + 568446438;
349
- a = (a << 5 | a >>> 27) + b << 0;
350
- d += (b ^ c & (a ^ b)) + blocks2[14] - 1019803690;
351
- d = (d << 9 | d >>> 23) + a << 0;
352
- c += (a ^ b & (d ^ a)) + blocks2[3] - 187363961;
353
- c = (c << 14 | c >>> 18) + d << 0;
354
- b += (d ^ a & (c ^ d)) + blocks2[8] + 1163531501;
355
- b = (b << 20 | b >>> 12) + c << 0;
356
- a += (c ^ d & (b ^ c)) + blocks2[13] - 1444681467;
357
- a = (a << 5 | a >>> 27) + b << 0;
358
- d += (b ^ c & (a ^ b)) + blocks2[2] - 51403784;
359
- d = (d << 9 | d >>> 23) + a << 0;
360
- c += (a ^ b & (d ^ a)) + blocks2[7] + 1735328473;
361
- c = (c << 14 | c >>> 18) + d << 0;
362
- b += (d ^ a & (c ^ d)) + blocks2[12] - 1926607734;
363
- b = (b << 20 | b >>> 12) + c << 0;
364
- bc = b ^ c;
365
- a += (bc ^ d) + blocks2[5] - 378558;
366
- a = (a << 4 | a >>> 28) + b << 0;
367
- d += (bc ^ a) + blocks2[8] - 2022574463;
368
- d = (d << 11 | d >>> 21) + a << 0;
369
- da = d ^ a;
370
- c += (da ^ b) + blocks2[11] + 1839030562;
371
- c = (c << 16 | c >>> 16) + d << 0;
372
- b += (da ^ c) + blocks2[14] - 35309556;
373
- b = (b << 23 | b >>> 9) + c << 0;
374
- bc = b ^ c;
375
- a += (bc ^ d) + blocks2[1] - 1530992060;
376
- a = (a << 4 | a >>> 28) + b << 0;
377
- d += (bc ^ a) + blocks2[4] + 1272893353;
378
- d = (d << 11 | d >>> 21) + a << 0;
379
- da = d ^ a;
380
- c += (da ^ b) + blocks2[7] - 155497632;
381
- c = (c << 16 | c >>> 16) + d << 0;
382
- b += (da ^ c) + blocks2[10] - 1094730640;
383
- b = (b << 23 | b >>> 9) + c << 0;
384
- bc = b ^ c;
385
- a += (bc ^ d) + blocks2[13] + 681279174;
386
- a = (a << 4 | a >>> 28) + b << 0;
387
- d += (bc ^ a) + blocks2[0] - 358537222;
388
- d = (d << 11 | d >>> 21) + a << 0;
389
- da = d ^ a;
390
- c += (da ^ b) + blocks2[3] - 722521979;
391
- c = (c << 16 | c >>> 16) + d << 0;
392
- b += (da ^ c) + blocks2[6] + 76029189;
393
- b = (b << 23 | b >>> 9) + c << 0;
394
- bc = b ^ c;
395
- a += (bc ^ d) + blocks2[9] - 640364487;
396
- a = (a << 4 | a >>> 28) + b << 0;
397
- d += (bc ^ a) + blocks2[12] - 421815835;
398
- d = (d << 11 | d >>> 21) + a << 0;
399
- da = d ^ a;
400
- c += (da ^ b) + blocks2[15] + 530742520;
401
- c = (c << 16 | c >>> 16) + d << 0;
402
- b += (da ^ c) + blocks2[2] - 995338651;
403
- b = (b << 23 | b >>> 9) + c << 0;
404
- a += (c ^ (b | ~d)) + blocks2[0] - 198630844;
405
- a = (a << 6 | a >>> 26) + b << 0;
406
- d += (b ^ (a | ~c)) + blocks2[7] + 1126891415;
407
- d = (d << 10 | d >>> 22) + a << 0;
408
- c += (a ^ (d | ~b)) + blocks2[14] - 1416354905;
409
- c = (c << 15 | c >>> 17) + d << 0;
410
- b += (d ^ (c | ~a)) + blocks2[5] - 57434055;
411
- b = (b << 21 | b >>> 11) + c << 0;
412
- a += (c ^ (b | ~d)) + blocks2[12] + 1700485571;
413
- a = (a << 6 | a >>> 26) + b << 0;
414
- d += (b ^ (a | ~c)) + blocks2[3] - 1894986606;
415
- d = (d << 10 | d >>> 22) + a << 0;
416
- c += (a ^ (d | ~b)) + blocks2[10] - 1051523;
417
- c = (c << 15 | c >>> 17) + d << 0;
418
- b += (d ^ (c | ~a)) + blocks2[1] - 2054922799;
419
- b = (b << 21 | b >>> 11) + c << 0;
420
- a += (c ^ (b | ~d)) + blocks2[8] + 1873313359;
421
- a = (a << 6 | a >>> 26) + b << 0;
422
- d += (b ^ (a | ~c)) + blocks2[15] - 30611744;
423
- d = (d << 10 | d >>> 22) + a << 0;
424
- c += (a ^ (d | ~b)) + blocks2[6] - 1560198380;
425
- c = (c << 15 | c >>> 17) + d << 0;
426
- b += (d ^ (c | ~a)) + blocks2[13] + 1309151649;
427
- b = (b << 21 | b >>> 11) + c << 0;
428
- a += (c ^ (b | ~d)) + blocks2[4] - 145523070;
429
- a = (a << 6 | a >>> 26) + b << 0;
430
- d += (b ^ (a | ~c)) + blocks2[11] - 1120210379;
431
- d = (d << 10 | d >>> 22) + a << 0;
432
- c += (a ^ (d | ~b)) + blocks2[2] + 718787259;
433
- c = (c << 15 | c >>> 17) + d << 0;
434
- b += (d ^ (c | ~a)) + blocks2[9] - 343485551;
435
- b = (b << 21 | b >>> 11) + c << 0;
436
- if (this.first) {
437
- this.h0 = a + 1732584193 << 0;
438
- this.h1 = b - 271733879 << 0;
439
- this.h2 = c - 1732584194 << 0;
440
- this.h3 = d + 271733878 << 0;
441
- this.first = false;
442
- } else {
443
- this.h0 = this.h0 + a << 0;
444
- this.h1 = this.h1 + b << 0;
445
- this.h2 = this.h2 + c << 0;
446
- this.h3 = this.h3 + d << 0;
447
- }
448
- };
449
- Md5.prototype.hex = function() {
450
- this.finalize();
451
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
452
- 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];
453
- };
454
- Md5.prototype.toString = Md5.prototype.hex;
455
- Md5.prototype.digest = function() {
456
- this.finalize();
457
- var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
458
- return [
459
- h0 & 255,
460
- h0 >>> 8 & 255,
461
- h0 >>> 16 & 255,
462
- h0 >>> 24 & 255,
463
- h1 & 255,
464
- h1 >>> 8 & 255,
465
- h1 >>> 16 & 255,
466
- h1 >>> 24 & 255,
467
- h2 & 255,
468
- h2 >>> 8 & 255,
469
- h2 >>> 16 & 255,
470
- h2 >>> 24 & 255,
471
- h3 & 255,
472
- h3 >>> 8 & 255,
473
- h3 >>> 16 & 255,
474
- h3 >>> 24 & 255
475
- ];
476
- };
477
- Md5.prototype.array = Md5.prototype.digest;
478
- Md5.prototype.arrayBuffer = function() {
479
- this.finalize();
480
- var buffer2 = new ArrayBuffer(16);
481
- var blocks2 = new Uint32Array(buffer2);
482
- blocks2[0] = this.h0;
483
- blocks2[1] = this.h1;
484
- blocks2[2] = this.h2;
485
- blocks2[3] = this.h3;
486
- return buffer2;
487
- };
488
- Md5.prototype.buffer = Md5.prototype.arrayBuffer;
489
- Md5.prototype.base64 = function() {
490
- var v1, v2, v3, base64Str = "", bytes = this.array();
491
- for (var i = 0; i < 15; ) {
492
- v1 = bytes[i++];
493
- v2 = bytes[i++];
494
- v3 = bytes[i++];
495
- 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];
496
- }
497
- v1 = bytes[i];
498
- base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[v1 << 4 & 63] + "==";
499
- return base64Str;
500
- };
501
- function HmacMd5(key, sharedMemory) {
502
- var i, result = formatMessage(key);
503
- key = result[0];
504
- if (result[1]) {
505
- var bytes = [], length = key.length, index = 0, code;
506
- for (i = 0; i < length; ++i) {
507
- code = key.charCodeAt(i);
508
- if (code < 128) {
509
- bytes[index++] = code;
510
- } else if (code < 2048) {
511
- bytes[index++] = 192 | code >>> 6;
512
- bytes[index++] = 128 | code & 63;
513
- } else if (code < 55296 || code >= 57344) {
514
- bytes[index++] = 224 | code >>> 12;
515
- bytes[index++] = 128 | code >>> 6 & 63;
516
- bytes[index++] = 128 | code & 63;
517
- } else {
518
- code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
519
- bytes[index++] = 240 | code >>> 18;
520
- bytes[index++] = 128 | code >>> 12 & 63;
521
- bytes[index++] = 128 | code >>> 6 & 63;
522
- bytes[index++] = 128 | code & 63;
523
- }
524
- }
525
- key = bytes;
526
- }
527
- if (key.length > 64) {
528
- key = new Md5(true).update(key).array();
529
- }
530
- var oKeyPad = [], iKeyPad = [];
531
- for (i = 0; i < 64; ++i) {
532
- var b = key[i] || 0;
533
- oKeyPad[i] = 92 ^ b;
534
- iKeyPad[i] = 54 ^ b;
535
- }
536
- Md5.call(this, sharedMemory);
537
- this.update(iKeyPad);
538
- this.oKeyPad = oKeyPad;
539
- this.inner = true;
540
- this.sharedMemory = sharedMemory;
541
- }
542
- HmacMd5.prototype = new Md5();
543
- HmacMd5.prototype.finalize = function() {
544
- Md5.prototype.finalize.call(this);
545
- if (this.inner) {
546
- this.inner = false;
547
- var innerHash = this.array();
548
- Md5.call(this, this.sharedMemory);
549
- this.update(this.oKeyPad);
550
- this.update(innerHash);
551
- Md5.prototype.finalize.call(this);
552
- }
553
- };
554
- var exports3 = createMethod();
555
- exports3.md5 = exports3;
556
- exports3.md5.hmac = createHmacMethod();
557
- if (COMMON_JS) {
558
- module2.exports = exports3;
559
- } else {
560
- root.md5 = exports3;
561
- if (AMD) {
562
- define(function() {
563
- return exports3;
564
- });
565
- }
566
- }
567
- })();
568
- }
569
- });
570
-
571
19
  // src/fingerprint/index.ts
572
20
  var index_exports = {};
573
21
  __export(index_exports, {
@@ -629,10 +77,18 @@ function resolvePerformance(options) {
629
77
  }
630
78
 
631
79
  // src/utils/collectUserData.ts
632
- var import_js_md5 = __toESM(require_md5(), 1);
633
80
  function item(category, key, label, value) {
634
81
  return { category, key, label, value: String(value ?? "\u2014") };
635
82
  }
83
+ function hashStringHex(input) {
84
+ let hash = 2166136261;
85
+ for (let i = 0; i < input.length; i += 1) {
86
+ hash ^= input.charCodeAt(i);
87
+ hash = Math.imul(hash, 16777619);
88
+ }
89
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
90
+ return `${part}${part}${part}${part}`;
91
+ }
636
92
  function getWebGLInfo() {
637
93
  var _a;
638
94
  try {
@@ -696,7 +152,7 @@ function getCanvasFingerprint() {
696
152
  ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
697
153
  ctx.fillText(txt, 4, 17);
698
154
  const dataUrl = c.toDataURL("image/png");
699
- return (0, import_js_md5.md5)(dataUrl).toUpperCase();
155
+ return hashStringHex(dataUrl);
700
156
  } catch {
701
157
  return "\u2014";
702
158
  }
@@ -1406,18 +862,29 @@ function gatherQuickSignals(options) {
1406
862
  }
1407
863
 
1408
864
  // src/fingerprint/hash.ts
1409
- var import_js_md52 = __toESM(require_md5(), 1);
1410
865
  function toHex(buffer) {
1411
866
  const bytes = new Uint8Array(buffer);
1412
867
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
1413
868
  }
1414
869
  async function createDigest(payload, algorithm = "SHA-256") {
1415
870
  if (algorithm === "MD5") {
1416
- return (0, import_js_md52.md5)(payload).toUpperCase();
871
+ let hash = 2166136261;
872
+ for (let i = 0; i < payload.length; i += 1) {
873
+ hash ^= payload.charCodeAt(i);
874
+ hash = Math.imul(hash, 16777619);
875
+ }
876
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
877
+ return `${part}${part}${part}${part}`;
1417
878
  }
1418
879
  const cryptoApi = globalThis.crypto;
1419
880
  if (!(cryptoApi == null ? void 0 : cryptoApi.subtle)) {
1420
- return (0, import_js_md52.md5)(payload).toUpperCase();
881
+ let hash = 2166136261;
882
+ for (let i = 0; i < payload.length; i += 1) {
883
+ hash ^= payload.charCodeAt(i);
884
+ hash = Math.imul(hash, 16777619);
885
+ }
886
+ const part = (hash >>> 0).toString(16).padStart(8, "0").toUpperCase();
887
+ return `${part}${part}${part}${part}`;
1421
888
  }
1422
889
  const encoded = new TextEncoder().encode(payload);
1423
890
  const digest = await cryptoApi.subtle.digest("SHA-256", encoded);
@@ -1479,6 +946,20 @@ var VOLATILE_DEVICE_KEYS = /* @__PURE__ */ new Set([
1479
946
  "screenLeft",
1480
947
  "screenTop"
1481
948
  ]);
949
+ var HARDWARE_DEVICE_KEYS = /* @__PURE__ */ new Set([
950
+ "hardwareConcurrency",
951
+ "deviceMemory",
952
+ "platform",
953
+ "unmaskedVendor",
954
+ "unmaskedRenderer",
955
+ "width",
956
+ "height",
957
+ "colorDepth",
958
+ "pixelDepth",
959
+ "timeZone",
960
+ "sampleRate",
961
+ "maxTouchPoints"
962
+ ]);
1482
963
  function getSignalStability(key) {
1483
964
  if (STABLE_DEVICE_KEYS.has(key)) {
1484
965
  return "stable";
@@ -1537,6 +1018,16 @@ function toCoreCanonicalPayload(components) {
1537
1018
  return false;
1538
1019
  }).map((component) => `${component.key}=${component.value}`).join("|");
1539
1020
  }
1021
+ function toHardwareCanonicalPayload(components) {
1022
+ return components.filter((component) => {
1023
+ if (component.kind === "required" && component.key === "required.merchantId") return true;
1024
+ if (component.kind === "device") {
1025
+ const key = component.key.replace(/^device\./, "");
1026
+ return HARDWARE_DEVICE_KEYS.has(key);
1027
+ }
1028
+ return false;
1029
+ }).map((component) => `${component.key}=${component.value}`).join("|");
1030
+ }
1540
1031
  function computeConfidenceScore(components, timedOutCollectors, failedCollectorsCount) {
1541
1032
  const weightedTotal = components.reduce((total, component) => total + component.weight, 0);
1542
1033
  if (weightedTotal === 0) {
@@ -1586,10 +1077,12 @@ async function getFingerprint(options) {
1586
1077
  deviceSignals: gathered.deviceSignals
1587
1078
  });
1588
1079
  const corePayload = toCoreCanonicalPayload(components);
1080
+ const hardwarePayload = toHardwareCanonicalPayload(components);
1589
1081
  const fullPayload = toCanonicalPayload(components);
1590
1082
  const digestAlgorithm = ((_a = options.hash) == null ? void 0 : _a.algorithm) ?? "SHA-256";
1591
- const [coreHash, fullHash] = await Promise.all([
1083
+ const [coreHash, hardwareCoreHash, fullHash] = await Promise.all([
1592
1084
  createDigest(corePayload, digestAlgorithm),
1085
+ createDigest(hardwarePayload, digestAlgorithm),
1593
1086
  createDigest(fullPayload, digestAlgorithm)
1594
1087
  ]);
1595
1088
  const completedAtMs = Date.now();
@@ -1597,6 +1090,7 @@ async function getFingerprint(options) {
1597
1090
  const maskedRaw = applyPrivacy(gathered.rawItems, ((_c = options.privacy) == null ? void 0 : _c.maskSensitive) ?? false);
1598
1091
  return {
1599
1092
  coreHash,
1093
+ hardwareCoreHash,
1600
1094
  fullHash,
1601
1095
  hash: fullHash,
1602
1096
  hashVersion: "fp_v1",
@@ -1637,10 +1131,12 @@ async function getFingerprintQuick(options) {
1637
1131
  deviceSignals: gathered.deviceSignals
1638
1132
  });
1639
1133
  const corePayload = toCoreCanonicalPayload(components);
1134
+ const hardwarePayload = toHardwareCanonicalPayload(components);
1640
1135
  const fullPayload = toCanonicalPayload(components);
1641
1136
  const digestAlgorithm = ((_a = options.hash) == null ? void 0 : _a.algorithm) ?? "SHA-256";
1642
- const [coreHash, fullHash] = await Promise.all([
1137
+ const [coreHash, hardwareCoreHash, fullHash] = await Promise.all([
1643
1138
  createDigest(corePayload, digestAlgorithm),
1139
+ createDigest(hardwarePayload, digestAlgorithm),
1644
1140
  createDigest(fullPayload, digestAlgorithm)
1645
1141
  ]);
1646
1142
  const completedAtMs = Date.now();
@@ -1648,6 +1144,7 @@ async function getFingerprintQuick(options) {
1648
1144
  const maskedRaw = applyPrivacy(gathered.rawItems, ((_c = options.privacy) == null ? void 0 : _c.maskSensitive) ?? false);
1649
1145
  return {
1650
1146
  coreHash,
1147
+ hardwareCoreHash,
1651
1148
  fullHash,
1652
1149
  hash: fullHash,
1653
1150
  hashVersion: "fp_v1",
@@ -1733,8 +1230,9 @@ function compareFingerprints(current, reference) {
1733
1230
  if (refComponent.stability === "volatile") changedVolatileKeys.push(refComponent.key);
1734
1231
  }
1735
1232
  const similarityScore = totalReferenceWeight === 0 ? 0 : round3(matchedWeight / totalReferenceWeight);
1233
+ const crossBrowserSimilarityScore = current.hardwareCoreHash === reference.hardwareCoreHash ? Math.max(similarityScore, 0.9) : similarityScore;
1736
1234
  const reasons = [];
1737
- let risk = 1 - similarityScore;
1235
+ let risk = 1 - crossBrowserSimilarityScore;
1738
1236
  if (changedStableKeys.length >= 3) {
1739
1237
  risk += 0.2;
1740
1238
  reasons.push("Multiple stable identifiers changed");
@@ -1777,13 +1275,15 @@ function compareFingerprints(current, reference) {
1777
1275
  const riskScore = round3(risk);
1778
1276
  let verdict = "different_device";
1779
1277
  if (similarityScore >= 0.85 && riskScore < 0.35) verdict = "same_device";
1278
+ else if (crossBrowserSimilarityScore >= 0.82 && riskScore < 0.45) verdict = "likely_same_cross_browser";
1780
1279
  else if (similarityScore >= 0.7 && riskScore < 0.55) verdict = "likely_same";
1781
- else if (similarityScore >= 0.45) verdict = "suspicious";
1280
+ else if (crossBrowserSimilarityScore >= 0.45) verdict = "suspicious";
1782
1281
  if (!reasons.length) {
1783
1282
  reasons.push("No meaningful drift between profiles");
1784
1283
  }
1785
1284
  return {
1786
1285
  similarityScore,
1286
+ crossBrowserSimilarityScore,
1787
1287
  riskScore,
1788
1288
  verdict,
1789
1289
  matchedWeight,
@@ -1798,13 +1298,13 @@ function buildIdentityId(profile) {
1798
1298
  }
1799
1299
  function compareFingerprintAgainstHistory(current, history2) {
1800
1300
  if (!history2.length) {
1801
- const self2 = compareFingerprints(current, current);
1301
+ const self = compareFingerprints(current, current);
1802
1302
  return {
1803
- best: self2,
1303
+ best: self,
1804
1304
  bestIndex: -1,
1805
1305
  comparedCount: 0,
1806
- aggregateRiskScore: self2.riskScore,
1807
- aggregateSimilarityScore: self2.similarityScore
1306
+ aggregateRiskScore: self.riskScore,
1307
+ aggregateSimilarityScore: self.similarityScore
1808
1308
  };
1809
1309
  }
1810
1310
  const comparisons = history2.map((entry) => compareFingerprints(current, entry));
@@ -1931,7 +1431,10 @@ function assessPaymentRisk(input) {
1931
1431
  var _a, _b, _c, _d;
1932
1432
  const reasons = [...input.comparison.reasons];
1933
1433
  let score = input.comparison.riskScore;
1934
- const similarityScore = input.comparison.similarityScore;
1434
+ const effectiveSimilarity = Math.max(
1435
+ input.comparison.similarityScore,
1436
+ input.comparison.crossBrowserSimilarityScore
1437
+ );
1935
1438
  if (input.history) {
1936
1439
  if (input.history.aggregateRiskScore > 0.6) {
1937
1440
  score += 0.1;
@@ -1961,14 +1464,14 @@ function assessPaymentRisk(input) {
1961
1464
  }
1962
1465
  const finalScore = Math.max(0, Math.min(1, Number(score.toFixed(3))));
1963
1466
  let decision = "manual_review";
1964
- if (finalScore < 0.35 && similarityScore >= 0.82) decision = "allow";
1965
- else if (finalScore < 0.55 && similarityScore >= 0.65) decision = "challenge";
1966
- else if (finalScore >= 0.8 || similarityScore < 0.35) decision = "deny";
1467
+ if (finalScore < 0.35 && effectiveSimilarity >= 0.82) decision = "allow";
1468
+ else if (finalScore < 0.55 && effectiveSimilarity >= 0.65) decision = "challenge";
1469
+ else if (finalScore >= 0.8 || effectiveSimilarity < 0.35) decision = "deny";
1967
1470
  const output = {
1968
1471
  decision,
1969
1472
  score: finalScore,
1970
1473
  reasons: Array.from(new Set(reasons)),
1971
- similarityScore,
1474
+ similarityScore: effectiveSimilarity,
1972
1475
  riskScore: input.comparison.riskScore
1973
1476
  };
1974
1477
  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(() => {
@@ -2000,16 +1503,3 @@ async function capturePaymentFingerprintNow(options) {
2000
1503
  resolveFingerprintPerformance,
2001
1504
  startPaymentFingerprintSession
2002
1505
  });
2003
- /*! Bundled license information:
2004
-
2005
- js-md5/src/md5.js:
2006
- (**
2007
- * [js-md5]{@link https://github.com/emn178/js-md5}
2008
- *
2009
- * @namespace md5
2010
- * @version 0.8.3
2011
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
2012
- * @copyright Chen, Yi-Cyuan 2014-2023
2013
- * @license MIT
2014
- *)
2015
- */