cyberchef 9.50.2 → 9.50.3
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.
|
|
3
|
+
"version": "9.50.3",
|
|
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",
|
|
@@ -11133,9 +11133,11 @@
|
|
|
11133
11133
|
"name": "By",
|
|
11134
11134
|
"type": "option",
|
|
11135
11135
|
"value": [
|
|
11136
|
+
"Byte",
|
|
11136
11137
|
"Character",
|
|
11137
11138
|
"Line"
|
|
11138
|
-
]
|
|
11139
|
+
],
|
|
11140
|
+
"defaultIndex": 1
|
|
11139
11141
|
}
|
|
11140
11142
|
]
|
|
11141
11143
|
},
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import Operation from "../Operation.mjs";
|
|
8
|
+
import Utils from "../Utils.mjs";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Reverse operation
|
|
@@ -26,7 +27,8 @@ class Reverse extends Operation {
|
|
|
26
27
|
{
|
|
27
28
|
"name": "By",
|
|
28
29
|
"type": "option",
|
|
29
|
-
"value": ["Character", "Line"]
|
|
30
|
+
"value": ["Byte", "Character", "Line"],
|
|
31
|
+
"defaultIndex": 1
|
|
30
32
|
}
|
|
31
33
|
];
|
|
32
34
|
}
|
|
@@ -57,6 +59,24 @@ class Reverse extends Operation {
|
|
|
57
59
|
result.push(0x0a);
|
|
58
60
|
}
|
|
59
61
|
return result.slice(0, input.length);
|
|
62
|
+
} else if (args[0] === "Character") {
|
|
63
|
+
const inputString = Utils.byteArrayToUtf8(input);
|
|
64
|
+
let result = "";
|
|
65
|
+
for (let i = inputString.length - 1; i >= 0; i--) {
|
|
66
|
+
const c = inputString.charCodeAt(i);
|
|
67
|
+
if (i > 0 && 0xdc00 <= c && c <= 0xdfff) {
|
|
68
|
+
const c2 = inputString.charCodeAt(i - 1);
|
|
69
|
+
if (0xd800 <= c2 && c2 <= 0xdbff) {
|
|
70
|
+
// surrogates
|
|
71
|
+
result += inputString.charAt(i - 1);
|
|
72
|
+
result += inputString.charAt(i);
|
|
73
|
+
i--;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
result += inputString.charAt(i);
|
|
78
|
+
}
|
|
79
|
+
return Utils.strToUtf8ByteArray(result);
|
|
60
80
|
} else {
|
|
61
81
|
return input.reverse();
|
|
62
82
|
}
|