cyberchef 9.50.10 → 9.50.11

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": "cyberchef",
3
- "version": "9.50.10",
3
+ "version": "9.50.11",
4
4
  "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
5
5
  "author": "n1474335 <n1474335@gmail.com>",
6
6
  "homepage": "https://gchq.github.io/CyberChef",
@@ -13086,7 +13086,8 @@
13086
13086
  "Alphabetical (case insensitive)",
13087
13087
  "IP address",
13088
13088
  "Numeric",
13089
- "Numeric (hexadecimal)"
13089
+ "Numeric (hexadecimal)",
13090
+ "Length"
13090
13091
  ]
13091
13092
  }
13092
13093
  ]
@@ -103,3 +103,15 @@ export function hexadecimalSort(a, b) {
103
103
 
104
104
  return a.localeCompare(b);
105
105
  }
106
+
107
+ /**
108
+ * Comparison operation for sorting by length
109
+ *
110
+ * @param {string} a
111
+ * @param {string} b
112
+ * @returns {number}
113
+ */
114
+ export function lengthSort(a, b) {
115
+ return a.length - b.length;
116
+ }
117
+
@@ -7,7 +7,7 @@
7
7
  import Operation from "../Operation.mjs";
8
8
  import Utils from "../Utils.mjs";
9
9
  import {INPUT_DELIM_OPTIONS} from "../lib/Delim.mjs";
10
- import {caseInsensitiveSort, ipSort, numericSort, hexadecimalSort} from "../lib/Sort.mjs";
10
+ import {caseInsensitiveSort, ipSort, numericSort, hexadecimalSort, lengthSort} from "../lib/Sort.mjs";
11
11
 
12
12
  /**
13
13
  * Sort operation
@@ -39,7 +39,7 @@ class Sort extends Operation {
39
39
  {
40
40
  "name": "Order",
41
41
  "type": "option",
42
- "value": ["Alphabetical (case sensitive)", "Alphabetical (case insensitive)", "IP address", "Numeric", "Numeric (hexadecimal)"]
42
+ "value": ["Alphabetical (case sensitive)", "Alphabetical (case insensitive)", "IP address", "Numeric", "Numeric (hexadecimal)", "Length"]
43
43
  }
44
44
  ];
45
45
  }
@@ -65,6 +65,8 @@ class Sort extends Operation {
65
65
  sorted = sorted.sort(numericSort);
66
66
  } else if (order === "Numeric (hexadecimal)") {
67
67
  sorted = sorted.sort(hexadecimalSort);
68
+ } else if (order === "Length") {
69
+ sorted = sorted.sort(lengthSort);
68
70
  }
69
71
 
70
72
  if (sortReverse) sorted.reverse();