devicer.js 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devicer.js",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Open-Source Digital Fingerprinting Middleware",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateConfidence = void 0;
4
4
  const tlsh_1 = require("./tlsh");
5
- function compareDataSets(data1, data2) {
5
+ function compareDatasets(data1, data2) {
6
6
  let fields = 0;
7
7
  let matches = 0;
8
8
  for (const key in data1) {
@@ -10,7 +10,7 @@ function compareDataSets(data1, data2) {
10
10
  fields++;
11
11
  if ((typeof data1[key] == "object" && data1[key]) &&
12
12
  (typeof data2[key] == "object" && data2[key])) {
13
- const subData = compareDataSets(data1[key], data2[key]);
13
+ const subData = compareDatasets(data1[key], data2[key]);
14
14
  fields += subData[0] - 1; // Subtract 1 for the key itself
15
15
  matches += subData[1];
16
16
  }
@@ -23,7 +23,7 @@ function compareDataSets(data1, data2) {
23
23
  }
24
24
  function calculateConfidence(data1, data2) {
25
25
  // Compare how many fields are the same in both datasets
26
- const [fields, matches] = compareDataSets(data1, data2);
26
+ const [fields, matches] = compareDatasets(data1, data2);
27
27
  if (fields === 0 || matches === 0) {
28
28
  return 0;
29
29
  }
@@ -33,7 +33,7 @@ function calculateConfidence(data1, data2) {
33
33
  // Compare the hashes to get their difference
34
34
  const differenceScore = (0, tlsh_1.compareHashes)(hash1, hash2);
35
35
  const inverseMatchScore = 1 - (matches / fields);
36
- const x = (differenceScore / 1.5) * inverseMatchScore;
36
+ const x = differenceScore * inverseMatchScore;
37
37
  if (inverseMatchScore === 0 || differenceScore === 0) {
38
38
  return 100;
39
39
  }
@@ -39,7 +39,7 @@ export function calculateConfidence(data1: FPDataSet, data2: FPDataSet): number
39
39
  const differenceScore = compareHashes(hash1, hash2);
40
40
 
41
41
  const inverseMatchScore = 1 - (matches / fields);
42
- const x = (differenceScore / 1.5) * inverseMatchScore
42
+ const x = differenceScore * inverseMatchScore
43
43
  if (inverseMatchScore === 0 || differenceScore === 0) {
44
44
  return 100;
45
45
  }