cyberchef 9.38.1 → 9.38.2

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.38.1",
3
+ "version": "9.38.2",
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",
@@ -44,8 +44,8 @@ class Substitute extends Operation {
44
44
  * @returns {string}
45
45
  */
46
46
  run(input, args) {
47
- const plaintext = Utils.expandAlphRange(args[0]).join(""),
48
- ciphertext = Utils.expandAlphRange(args[1]).join("");
47
+ const plaintext = Utils.expandAlphRange([...args[0]]),
48
+ ciphertext = Utils.expandAlphRange([...args[1]]);
49
49
  let output = "",
50
50
  index = -1;
51
51
 
@@ -53,9 +53,9 @@ class Substitute extends Operation {
53
53
  output = "Warning: Plaintext and Ciphertext lengths differ\n\n";
54
54
  }
55
55
 
56
- for (let i = 0; i < input.length; i++) {
57
- index = plaintext.indexOf(input[i]);
58
- output += index > -1 && index < ciphertext.length ? ciphertext[index] : input[i];
56
+ for (const character of input) {
57
+ index = plaintext.indexOf(character);
58
+ output += index > -1 && index < ciphertext.length ? ciphertext[index] : character;
59
59
  }
60
60
 
61
61
  return output;