cyberchef 9.43.0 → 9.46.0
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/CHANGELOG.md +19 -0
- package/package.json +2 -1
- package/src/core/config/Categories.json +8 -2
- package/src/core/config/OperationConfig.json +77 -0
- package/src/core/config/modules/Ciphers.mjs +4 -0
- package/src/core/config/modules/Compression.mjs +4 -0
- package/src/core/config/modules/Default.mjs +2 -0
- package/src/core/lib/LZString.mjs +21 -0
- package/src/core/operations/CetaceanCipherDecode.mjs +63 -0
- package/src/core/operations/CetaceanCipherEncode.mjs +51 -0
- package/src/core/operations/LZStringCompress.mjs +55 -0
- package/src/core/operations/LZStringDecompress.mjs +56 -0
- package/src/core/operations/ROT8000.mjs +123 -0
- package/src/core/operations/index.mjs +10 -0
- package/src/node/index.mjs +25 -0
- package/tests/browser/ops.js +1 -0
- package/tests/operations/index.mjs +3 -0
- package/tests/operations/tests/CetaceanCipherDecode.mjs +22 -0
- package/tests/operations/tests/CetaceanCipherEncode.mjs +22 -0
- package/tests/operations/tests/LZString.mjs +33 -0
- package/tests/operations/tests/Rotate.mjs +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,15 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
13
13
|
|
|
14
14
|
## Details
|
|
15
15
|
|
|
16
|
+
### [9.45.0] - 2022-07-08
|
|
17
|
+
- Added 'ROT8000' operation [@thomasleplus] | [#1250]
|
|
18
|
+
|
|
19
|
+
### [9.44.0] - 2022-07-08
|
|
20
|
+
- Added 'LZString Compress' and 'LZString Decompress' operations [@crespyl] | [#1266]
|
|
21
|
+
|
|
22
|
+
### [9.43.0] - 2022-07-08
|
|
23
|
+
- Added 'ROT13 Brute Force' and 'ROT47 Brute Force' operations [@mikecat] | [#1264]
|
|
24
|
+
|
|
16
25
|
### [9.42.0] - 2022-07-08
|
|
17
26
|
- Added 'LS47 Encrypt' and 'LS47 Decrypt' operations [@n1073645] | [#951]
|
|
18
27
|
|
|
@@ -303,6 +312,9 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
303
312
|
|
|
304
313
|
|
|
305
314
|
|
|
315
|
+
[9.45.0]: https://github.com/gchq/CyberChef/releases/tag/v9.45.0
|
|
316
|
+
[9.44.0]: https://github.com/gchq/CyberChef/releases/tag/v9.44.0
|
|
317
|
+
[9.43.0]: https://github.com/gchq/CyberChef/releases/tag/v9.43.0
|
|
306
318
|
[9.42.0]: https://github.com/gchq/CyberChef/releases/tag/v9.42.0
|
|
307
319
|
[9.41.0]: https://github.com/gchq/CyberChef/releases/tag/v9.41.0
|
|
308
320
|
[9.40.0]: https://github.com/gchq/CyberChef/releases/tag/v9.40.0
|
|
@@ -430,6 +442,9 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
430
442
|
[@t-8ch]: https://github.com/t-8ch
|
|
431
443
|
[@hettysymes]: https://github.com/hettysymes
|
|
432
444
|
[@swesven]: https://github.com/swesven
|
|
445
|
+
[@mikecat]: https://github.com/mikecat
|
|
446
|
+
[@crespyl]: https://github.com/crespyl
|
|
447
|
+
[@thomasleplus]: https://github.com/thomasleplus
|
|
433
448
|
|
|
434
449
|
[8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7
|
|
435
450
|
[9a33498]: https://github.com/gchq/CyberChef/commit/9a33498fed26a8df9c9f35f39a78a174bf50a513
|
|
@@ -528,3 +543,7 @@ All major and minor version changes will be documented in this file. Details of
|
|
|
528
543
|
[#1313]: https://github.com/gchq/CyberChef/pull/1313
|
|
529
544
|
[#1326]: https://github.com/gchq/CyberChef/pull/1326
|
|
530
545
|
[#1364]: https://github.com/gchq/CyberChef/pull/1364
|
|
546
|
+
[#1264]: https://github.com/gchq/CyberChef/pull/1264
|
|
547
|
+
[#1266]: https://github.com/gchq/CyberChef/pull/1266
|
|
548
|
+
[#1250]: https://github.com/gchq/CyberChef/pull/1250
|
|
549
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyberchef",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.46.0",
|
|
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",
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
"lodash": "^4.17.21",
|
|
134
134
|
"loglevel": "^1.8.0",
|
|
135
135
|
"loglevel-message-prefix": "^3.0.0",
|
|
136
|
+
"lz-string": "^1.4.4",
|
|
136
137
|
"markdown-it": "^13.0.1",
|
|
137
138
|
"moment": "^2.29.3",
|
|
138
139
|
"moment-timezone": "^0.5.34",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"ROT13 Brute Force",
|
|
92
92
|
"ROT47",
|
|
93
93
|
"ROT47 Brute Force",
|
|
94
|
+
"ROT8000",
|
|
94
95
|
"XOR",
|
|
95
96
|
"XOR Brute Force",
|
|
96
97
|
"Vigenère Encode",
|
|
@@ -111,6 +112,8 @@
|
|
|
111
112
|
"Atbash Cipher",
|
|
112
113
|
"CipherSaber2 Encrypt",
|
|
113
114
|
"CipherSaber2 Decrypt",
|
|
115
|
+
"Cetacean Cipher Encode",
|
|
116
|
+
"Cetacean Cipher Decode",
|
|
114
117
|
"Substitute",
|
|
115
118
|
"Derive PBKDF2 key",
|
|
116
119
|
"Derive EVP key",
|
|
@@ -181,7 +184,8 @@
|
|
|
181
184
|
"Bit shift right",
|
|
182
185
|
"Rotate left",
|
|
183
186
|
"Rotate right",
|
|
184
|
-
"ROT13"
|
|
187
|
+
"ROT13",
|
|
188
|
+
"ROT8000"
|
|
185
189
|
]
|
|
186
190
|
},
|
|
187
191
|
{
|
|
@@ -325,7 +329,9 @@
|
|
|
325
329
|
"Bzip2 Decompress",
|
|
326
330
|
"Bzip2 Compress",
|
|
327
331
|
"Tar",
|
|
328
|
-
"Untar"
|
|
332
|
+
"Untar",
|
|
333
|
+
"LZString Compress",
|
|
334
|
+
"LZString Decompress"
|
|
329
335
|
]
|
|
330
336
|
},
|
|
331
337
|
{
|
|
@@ -1506,6 +1506,33 @@
|
|
|
1506
1506
|
}
|
|
1507
1507
|
]
|
|
1508
1508
|
},
|
|
1509
|
+
"Cetacean Cipher Decode": {
|
|
1510
|
+
"module": "Ciphers",
|
|
1511
|
+
"description": "Decode Cetacean Cipher input. <br/><br/>e.g. <code>EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe</code> becomes <code>hi</code>",
|
|
1512
|
+
"infoURL": "https://hitchhikers.fandom.com/wiki/Dolphins",
|
|
1513
|
+
"inputType": "string",
|
|
1514
|
+
"outputType": "string",
|
|
1515
|
+
"flowControl": false,
|
|
1516
|
+
"manualBake": false,
|
|
1517
|
+
"args": [],
|
|
1518
|
+
"checks": [
|
|
1519
|
+
{
|
|
1520
|
+
"pattern": "^(?:[eE]{16,})(?: [eE]{16,})*$",
|
|
1521
|
+
"flags": "",
|
|
1522
|
+
"args": []
|
|
1523
|
+
}
|
|
1524
|
+
]
|
|
1525
|
+
},
|
|
1526
|
+
"Cetacean Cipher Encode": {
|
|
1527
|
+
"module": "Ciphers",
|
|
1528
|
+
"description": "Converts any input into Cetacean Cipher. <br/><br/>e.g. <code>hi</code> becomes <code>EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe</code>",
|
|
1529
|
+
"infoURL": "https://hitchhikers.fandom.com/wiki/Dolphins",
|
|
1530
|
+
"inputType": "string",
|
|
1531
|
+
"outputType": "string",
|
|
1532
|
+
"flowControl": false,
|
|
1533
|
+
"manualBake": false,
|
|
1534
|
+
"args": []
|
|
1535
|
+
},
|
|
1509
1536
|
"Change IP format": {
|
|
1510
1537
|
"module": "Default",
|
|
1511
1538
|
"description": "Convert an IP address from one format to another, e.g. <code>172.20.23.54</code> to <code>ac141736</code>",
|
|
@@ -7981,6 +8008,46 @@
|
|
|
7981
8008
|
}
|
|
7982
8009
|
]
|
|
7983
8010
|
},
|
|
8011
|
+
"LZString Compress": {
|
|
8012
|
+
"module": "Compression",
|
|
8013
|
+
"description": "Compress the input with lz-string.",
|
|
8014
|
+
"infoURL": "https://pieroxy.net/blog/pages/lz-string/index.html",
|
|
8015
|
+
"inputType": "string",
|
|
8016
|
+
"outputType": "string",
|
|
8017
|
+
"flowControl": false,
|
|
8018
|
+
"manualBake": false,
|
|
8019
|
+
"args": [
|
|
8020
|
+
{
|
|
8021
|
+
"name": "Compression Format",
|
|
8022
|
+
"type": "option",
|
|
8023
|
+
"value": [
|
|
8024
|
+
"default",
|
|
8025
|
+
"UTF16",
|
|
8026
|
+
"Base64"
|
|
8027
|
+
]
|
|
8028
|
+
}
|
|
8029
|
+
]
|
|
8030
|
+
},
|
|
8031
|
+
"LZString Decompress": {
|
|
8032
|
+
"module": "Compression",
|
|
8033
|
+
"description": "Decompresses data that was compressed with lz-string.",
|
|
8034
|
+
"infoURL": "https://pieroxy.net/blog/pages/lz-string/index.html",
|
|
8035
|
+
"inputType": "string",
|
|
8036
|
+
"outputType": "string",
|
|
8037
|
+
"flowControl": false,
|
|
8038
|
+
"manualBake": false,
|
|
8039
|
+
"args": [
|
|
8040
|
+
{
|
|
8041
|
+
"name": "Compression Format",
|
|
8042
|
+
"type": "option",
|
|
8043
|
+
"value": [
|
|
8044
|
+
"default",
|
|
8045
|
+
"UTF16",
|
|
8046
|
+
"Base64"
|
|
8047
|
+
]
|
|
8048
|
+
}
|
|
8049
|
+
]
|
|
8050
|
+
},
|
|
7984
8051
|
"Label": {
|
|
7985
8052
|
"module": "Default",
|
|
7986
8053
|
"description": "Provides a location for conditional and fixed jumps to redirect execution to.",
|
|
@@ -10271,6 +10338,16 @@
|
|
|
10271
10338
|
}
|
|
10272
10339
|
]
|
|
10273
10340
|
},
|
|
10341
|
+
"ROT8000": {
|
|
10342
|
+
"module": "Default",
|
|
10343
|
+
"description": "The simple Caesar-cypher encryption that replaces each Unicode character with the one 0x8000 places forward or back along the alphabet.",
|
|
10344
|
+
"infoURL": "https://rot8000.com/info",
|
|
10345
|
+
"inputType": "string",
|
|
10346
|
+
"outputType": "string",
|
|
10347
|
+
"flowControl": false,
|
|
10348
|
+
"manualBake": false,
|
|
10349
|
+
"args": []
|
|
10350
|
+
},
|
|
10274
10351
|
"RSA Decrypt": {
|
|
10275
10352
|
"module": "Ciphers",
|
|
10276
10353
|
"description": "Decrypt an RSA encrypted message with a PEM encoded private key.",
|
|
@@ -17,6 +17,8 @@ import BifidCipherEncode from "../../operations/BifidCipherEncode.mjs";
|
|
|
17
17
|
import BlowfishDecrypt from "../../operations/BlowfishDecrypt.mjs";
|
|
18
18
|
import BlowfishEncrypt from "../../operations/BlowfishEncrypt.mjs";
|
|
19
19
|
import CaesarBoxCipher from "../../operations/CaesarBoxCipher.mjs";
|
|
20
|
+
import CetaceanCipherDecode from "../../operations/CetaceanCipherDecode.mjs";
|
|
21
|
+
import CetaceanCipherEncode from "../../operations/CetaceanCipherEncode.mjs";
|
|
20
22
|
import DESDecrypt from "../../operations/DESDecrypt.mjs";
|
|
21
23
|
import DESEncrypt from "../../operations/DESEncrypt.mjs";
|
|
22
24
|
import DeriveEVPKey from "../../operations/DeriveEVPKey.mjs";
|
|
@@ -55,6 +57,8 @@ OpModules.Ciphers = {
|
|
|
55
57
|
"Blowfish Decrypt": BlowfishDecrypt,
|
|
56
58
|
"Blowfish Encrypt": BlowfishEncrypt,
|
|
57
59
|
"Caesar Box Cipher": CaesarBoxCipher,
|
|
60
|
+
"Cetacean Cipher Decode": CetaceanCipherDecode,
|
|
61
|
+
"Cetacean Cipher Encode": CetaceanCipherEncode,
|
|
58
62
|
"DES Decrypt": DESDecrypt,
|
|
59
63
|
"DES Encrypt": DESEncrypt,
|
|
60
64
|
"Derive EVP key": DeriveEVPKey,
|
|
@@ -9,6 +9,8 @@ import Bzip2Compress from "../../operations/Bzip2Compress.mjs";
|
|
|
9
9
|
import Bzip2Decompress from "../../operations/Bzip2Decompress.mjs";
|
|
10
10
|
import Gunzip from "../../operations/Gunzip.mjs";
|
|
11
11
|
import Gzip from "../../operations/Gzip.mjs";
|
|
12
|
+
import LZStringCompress from "../../operations/LZStringCompress.mjs";
|
|
13
|
+
import LZStringDecompress from "../../operations/LZStringDecompress.mjs";
|
|
12
14
|
import RawDeflate from "../../operations/RawDeflate.mjs";
|
|
13
15
|
import RawInflate from "../../operations/RawInflate.mjs";
|
|
14
16
|
import Tar from "../../operations/Tar.mjs";
|
|
@@ -25,6 +27,8 @@ OpModules.Compression = {
|
|
|
25
27
|
"Bzip2 Decompress": Bzip2Decompress,
|
|
26
28
|
"Gunzip": Gunzip,
|
|
27
29
|
"Gzip": Gzip,
|
|
30
|
+
"LZString Compress": LZStringCompress,
|
|
31
|
+
"LZString Decompress": LZStringDecompress,
|
|
28
32
|
"Raw Deflate": RawDeflate,
|
|
29
33
|
"Raw Inflate": RawInflate,
|
|
30
34
|
"Tar": Tar,
|
|
@@ -110,6 +110,7 @@ import ROT13 from "../../operations/ROT13.mjs";
|
|
|
110
110
|
import ROT13BruteForce from "../../operations/ROT13BruteForce.mjs";
|
|
111
111
|
import ROT47 from "../../operations/ROT47.mjs";
|
|
112
112
|
import ROT47BruteForce from "../../operations/ROT47BruteForce.mjs";
|
|
113
|
+
import ROT8000 from "../../operations/ROT8000.mjs";
|
|
113
114
|
import RemoveDiacritics from "../../operations/RemoveDiacritics.mjs";
|
|
114
115
|
import RemoveLineNumbers from "../../operations/RemoveLineNumbers.mjs";
|
|
115
116
|
import RemoveNullBytes from "../../operations/RemoveNullBytes.mjs";
|
|
@@ -282,6 +283,7 @@ OpModules.Default = {
|
|
|
282
283
|
"ROT13 Brute Force": ROT13BruteForce,
|
|
283
284
|
"ROT47": ROT47,
|
|
284
285
|
"ROT47 Brute Force": ROT47BruteForce,
|
|
286
|
+
"ROT8000": ROT8000,
|
|
285
287
|
"Remove Diacritics": RemoveDiacritics,
|
|
286
288
|
"Remove line numbers": RemoveLineNumbers,
|
|
287
289
|
"Remove null bytes": RemoveNullBytes,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lz-string exports.
|
|
3
|
+
*
|
|
4
|
+
* @author crespyl [peter@crespyl.net]
|
|
5
|
+
* @copyright Peter Jacobs 2021
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import LZString from "lz-string";
|
|
10
|
+
|
|
11
|
+
export const COMPRESSION_OUTPUT_FORMATS = ["default", "UTF16", "Base64"];
|
|
12
|
+
export const COMPRESSION_FUNCTIONS = {
|
|
13
|
+
"default": LZString.compress,
|
|
14
|
+
"UTF16": LZString.compressToUTF16,
|
|
15
|
+
"Base64": LZString.compressToBase64,
|
|
16
|
+
};
|
|
17
|
+
export const DECOMPRESSION_FUNCTIONS = {
|
|
18
|
+
"default": LZString.decompress,
|
|
19
|
+
"UTF16": LZString.decompressFromUTF16,
|
|
20
|
+
"Base64": LZString.decompressFromBase64,
|
|
21
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author dolphinOnKeys [robin@weird.io]
|
|
3
|
+
* @copyright Crown Copyright 2022
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Operation from "../Operation.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Cetacean Cipher Decode operation
|
|
11
|
+
*/
|
|
12
|
+
class CetaceanCipherDecode extends Operation {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* CetaceanCipherDecode constructor
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
this.name = "Cetacean Cipher Decode";
|
|
21
|
+
this.module = "Ciphers";
|
|
22
|
+
this.description = "Decode Cetacean Cipher input. <br/><br/>e.g. <code>EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe</code> becomes <code>hi</code>";
|
|
23
|
+
this.infoURL = "https://hitchhikers.fandom.com/wiki/Dolphins";
|
|
24
|
+
this.inputType = "string";
|
|
25
|
+
this.outputType = "string";
|
|
26
|
+
|
|
27
|
+
this.checks = [
|
|
28
|
+
{
|
|
29
|
+
pattern: "^(?:[eE]{16,})(?: [eE]{16,})*$",
|
|
30
|
+
flags: "",
|
|
31
|
+
args: []
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} input
|
|
38
|
+
* @param {Object[]} args
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
run(input, args) {
|
|
42
|
+
const binaryArray = [];
|
|
43
|
+
for (const char of input) {
|
|
44
|
+
if (char === " ") {
|
|
45
|
+
binaryArray.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]);
|
|
46
|
+
} else {
|
|
47
|
+
binaryArray.push(char === "e" ? 1 : 0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const byteArray = [];
|
|
52
|
+
|
|
53
|
+
for (let i = 0; i < binaryArray.length; i += 16) {
|
|
54
|
+
byteArray.push(binaryArray.slice(i, i + 16).join(""));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return byteArray.map(byte =>
|
|
58
|
+
String.fromCharCode(parseInt(byte, 2))
|
|
59
|
+
).join("");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default CetaceanCipherDecode;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author dolphinOnKeys [robin@weird.io]
|
|
3
|
+
* @copyright Crown Copyright 2022
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Operation from "../Operation.mjs";
|
|
8
|
+
import {toBinary} from "../lib/Binary.mjs";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Cetacean Cipher Encode operation
|
|
12
|
+
*/
|
|
13
|
+
class CetaceanCipherEncode extends Operation {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CetaceanCipherEncode constructor
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
this.name = "Cetacean Cipher Encode";
|
|
22
|
+
this.module = "Ciphers";
|
|
23
|
+
this.description = "Converts any input into Cetacean Cipher. <br/><br/>e.g. <code>hi</code> becomes <code>EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe</code>";
|
|
24
|
+
this.infoURL = "https://hitchhikers.fandom.com/wiki/Dolphins";
|
|
25
|
+
this.inputType = "string";
|
|
26
|
+
this.outputType = "string";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} input
|
|
31
|
+
* @param {Object[]} args
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
run(input, args) {
|
|
35
|
+
const result = [];
|
|
36
|
+
const charArray = input.split("");
|
|
37
|
+
|
|
38
|
+
charArray.map(character => {
|
|
39
|
+
if (character === " ") {
|
|
40
|
+
result.push(character);
|
|
41
|
+
} else {
|
|
42
|
+
const binaryArray = toBinary(character.charCodeAt(0), "None", 16).split("");
|
|
43
|
+
result.push(binaryArray.map(str => str === "1" ? "e" : "E").join(""));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return result.join("");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default CetaceanCipherEncode;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author crespyl [peter@crespyl.net]
|
|
3
|
+
* @copyright Peter Jacobs 2021
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Operation from "../Operation.mjs";
|
|
8
|
+
import OperationError from "../errors/OperationError.mjs";
|
|
9
|
+
|
|
10
|
+
import {COMPRESSION_OUTPUT_FORMATS, COMPRESSION_FUNCTIONS} from "../lib/LZString.mjs";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* LZString Compress operation
|
|
14
|
+
*/
|
|
15
|
+
class LZStringCompress extends Operation {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* LZStringCompress constructor
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
|
|
23
|
+
this.name = "LZString Compress";
|
|
24
|
+
this.module = "Compression";
|
|
25
|
+
this.description = "Compress the input with lz-string.";
|
|
26
|
+
this.infoURL = "https://pieroxy.net/blog/pages/lz-string/index.html";
|
|
27
|
+
this.inputType = "string";
|
|
28
|
+
this.outputType = "string";
|
|
29
|
+
this.args = [
|
|
30
|
+
{
|
|
31
|
+
name: "Compression Format",
|
|
32
|
+
type: "option",
|
|
33
|
+
defaultIndex: 0,
|
|
34
|
+
value: COMPRESSION_OUTPUT_FORMATS
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} input
|
|
41
|
+
* @param {Object[]} args
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
run(input, args) {
|
|
45
|
+
const compress = COMPRESSION_FUNCTIONS[args[0]];
|
|
46
|
+
if (compress) {
|
|
47
|
+
return compress(input);
|
|
48
|
+
} else {
|
|
49
|
+
throw new OperationError("Unable to find compression function");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default LZStringCompress;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author crespyl [peter@crespyl.net]
|
|
3
|
+
* @copyright Peter Jacobs 2021
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Operation from "../Operation.mjs";
|
|
8
|
+
import OperationError from "../errors/OperationError.mjs";
|
|
9
|
+
|
|
10
|
+
import {COMPRESSION_OUTPUT_FORMATS, DECOMPRESSION_FUNCTIONS} from "../lib/LZString.mjs";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* LZString Decompress operation
|
|
14
|
+
*/
|
|
15
|
+
class LZStringDecompress extends Operation {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* LZStringDecompress constructor
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
|
|
23
|
+
this.name = "LZString Decompress";
|
|
24
|
+
this.module = "Compression";
|
|
25
|
+
this.description = "Decompresses data that was compressed with lz-string.";
|
|
26
|
+
this.infoURL = "https://pieroxy.net/blog/pages/lz-string/index.html";
|
|
27
|
+
this.inputType = "string";
|
|
28
|
+
this.outputType = "string";
|
|
29
|
+
this.args = [
|
|
30
|
+
{
|
|
31
|
+
name: "Compression Format",
|
|
32
|
+
type: "option",
|
|
33
|
+
defaultIndex: 0,
|
|
34
|
+
value: COMPRESSION_OUTPUT_FORMATS
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} input
|
|
41
|
+
* @param {Object[]} args
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
run(input, args) {
|
|
45
|
+
const decompress = DECOMPRESSION_FUNCTIONS[args[0]];
|
|
46
|
+
if (decompress) {
|
|
47
|
+
return decompress(input);
|
|
48
|
+
} else {
|
|
49
|
+
throw new OperationError("Unable to find decompression function");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default LZStringDecompress;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daniel Temkin [http://danieltemkin.com]
|
|
3
|
+
* @author Thomas Leplus [https://www.leplus.org]
|
|
4
|
+
* @copyright Crown Copyright 2021
|
|
5
|
+
* @license Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Operation from "../Operation.mjs";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ROT8000 operation.
|
|
12
|
+
*/
|
|
13
|
+
class ROT8000 extends Operation {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* ROT8000 constructor
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.name = "ROT8000";
|
|
21
|
+
this.module = "Default";
|
|
22
|
+
this.description = "The simple Caesar-cypher encryption that replaces each Unicode character with the one 0x8000 places forward or back along the alphabet.";
|
|
23
|
+
this.infoURL = "https://rot8000.com/info";
|
|
24
|
+
this.inputType = "string";
|
|
25
|
+
this.outputType = "string";
|
|
26
|
+
this.args = [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {byteArray} input
|
|
31
|
+
* @param {Object[]} args
|
|
32
|
+
* @returns {byteArray}
|
|
33
|
+
*/
|
|
34
|
+
run(input, args) {
|
|
35
|
+
// Inspired from https://github.com/rottytooth/rot8000/blob/main/rot8000.js
|
|
36
|
+
// these come from the valid-code-point-transitions.json file generated from the c# proj
|
|
37
|
+
// this is done bc: 1) don't trust JS's understanging of surrogate pairs and 2) consistency with original rot8000
|
|
38
|
+
const validCodePoints = {
|
|
39
|
+
"33": true,
|
|
40
|
+
"127": false,
|
|
41
|
+
"161": true,
|
|
42
|
+
"5760": false,
|
|
43
|
+
"5761": true,
|
|
44
|
+
"8192": false,
|
|
45
|
+
"8203": true,
|
|
46
|
+
"8232": false,
|
|
47
|
+
"8234": true,
|
|
48
|
+
"8239": false,
|
|
49
|
+
"8240": true,
|
|
50
|
+
"8287": false,
|
|
51
|
+
"8288": true,
|
|
52
|
+
"12288": false,
|
|
53
|
+
"12289": true,
|
|
54
|
+
"55296": false,
|
|
55
|
+
"57344": true
|
|
56
|
+
};
|
|
57
|
+
const bmpSize = 0x10000;
|
|
58
|
+
const rotList = {}; // the mapping of char to rotated char
|
|
59
|
+
const hiddenBlocks = [];
|
|
60
|
+
let startBlock = 0;
|
|
61
|
+
for (const key in validCodePoints) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(validCodePoints, key)) {
|
|
63
|
+
if (validCodePoints[key] === true)
|
|
64
|
+
hiddenBlocks.push({ start: startBlock, end: parseInt(key, 10) - 1 });
|
|
65
|
+
else
|
|
66
|
+
startBlock = parseInt(key, 10);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const validIntList = []; // list of all valid chars
|
|
70
|
+
let currValid = false;
|
|
71
|
+
for (let i = 0; i < bmpSize; i++) {
|
|
72
|
+
if (validCodePoints[i] !== undefined) {
|
|
73
|
+
currValid = validCodePoints[i];
|
|
74
|
+
}
|
|
75
|
+
if (currValid) validIntList.push(i);
|
|
76
|
+
}
|
|
77
|
+
const rotateNum = Object.keys(validIntList).length / 2;
|
|
78
|
+
// go through every valid char and find its match
|
|
79
|
+
for (let i = 0; i < validIntList.length; i++) {
|
|
80
|
+
rotList[String.fromCharCode(validIntList[i])] =
|
|
81
|
+
String.fromCharCode(validIntList[(i + rotateNum) % (rotateNum * 2)]);
|
|
82
|
+
}
|
|
83
|
+
let output = "";
|
|
84
|
+
for (let count = 0; count < input.length; count++) {
|
|
85
|
+
// if it is not in the mappings list, just add it directly (no rotation)
|
|
86
|
+
if (rotList[input[count]] === undefined) {
|
|
87
|
+
output += input[count];
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// otherwise, rotate it and add it to the string
|
|
91
|
+
output += rotList[input[count]];
|
|
92
|
+
}
|
|
93
|
+
return output;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Highlight ROT8000
|
|
98
|
+
*
|
|
99
|
+
* @param {Object[]} pos
|
|
100
|
+
* @param {number} pos[].start
|
|
101
|
+
* @param {number} pos[].end
|
|
102
|
+
* @param {Object[]} args
|
|
103
|
+
* @returns {Object[]} pos
|
|
104
|
+
*/
|
|
105
|
+
highlight(pos, args) {
|
|
106
|
+
return pos;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Highlight ROT8000 in reverse
|
|
111
|
+
*
|
|
112
|
+
* @param {Object[]} pos
|
|
113
|
+
* @param {number} pos[].start
|
|
114
|
+
* @param {number} pos[].end
|
|
115
|
+
* @param {Object[]} args
|
|
116
|
+
* @returns {Object[]} pos
|
|
117
|
+
*/
|
|
118
|
+
highlightReverse(pos, args) {
|
|
119
|
+
return pos;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default ROT8000;
|
|
@@ -50,6 +50,8 @@ import CSVToJSON from "./CSVToJSON.mjs";
|
|
|
50
50
|
import CTPH from "./CTPH.mjs";
|
|
51
51
|
import CaesarBoxCipher from "./CaesarBoxCipher.mjs";
|
|
52
52
|
import CartesianProduct from "./CartesianProduct.mjs";
|
|
53
|
+
import CetaceanCipherDecode from "./CetaceanCipherDecode.mjs";
|
|
54
|
+
import CetaceanCipherEncode from "./CetaceanCipherEncode.mjs";
|
|
53
55
|
import ChangeIPFormat from "./ChangeIPFormat.mjs";
|
|
54
56
|
import ChiSquare from "./ChiSquare.mjs";
|
|
55
57
|
import CipherSaber2Decrypt from "./CipherSaber2Decrypt.mjs";
|
|
@@ -194,6 +196,8 @@ import Jump from "./Jump.mjs";
|
|
|
194
196
|
import Keccak from "./Keccak.mjs";
|
|
195
197
|
import LS47Decrypt from "./LS47Decrypt.mjs";
|
|
196
198
|
import LS47Encrypt from "./LS47Encrypt.mjs";
|
|
199
|
+
import LZStringCompress from "./LZStringCompress.mjs";
|
|
200
|
+
import LZStringDecompress from "./LZStringDecompress.mjs";
|
|
197
201
|
import Label from "./Label.mjs";
|
|
198
202
|
import Lorenz from "./Lorenz.mjs";
|
|
199
203
|
import LuhnChecksum from "./LuhnChecksum.mjs";
|
|
@@ -255,6 +259,7 @@ import ROT13 from "./ROT13.mjs";
|
|
|
255
259
|
import ROT13BruteForce from "./ROT13BruteForce.mjs";
|
|
256
260
|
import ROT47 from "./ROT47.mjs";
|
|
257
261
|
import ROT47BruteForce from "./ROT47BruteForce.mjs";
|
|
262
|
+
import ROT8000 from "./ROT8000.mjs";
|
|
258
263
|
import RSADecrypt from "./RSADecrypt.mjs";
|
|
259
264
|
import RSAEncrypt from "./RSAEncrypt.mjs";
|
|
260
265
|
import RSASign from "./RSASign.mjs";
|
|
@@ -430,6 +435,8 @@ export {
|
|
|
430
435
|
CTPH,
|
|
431
436
|
CaesarBoxCipher,
|
|
432
437
|
CartesianProduct,
|
|
438
|
+
CetaceanCipherDecode,
|
|
439
|
+
CetaceanCipherEncode,
|
|
433
440
|
ChangeIPFormat,
|
|
434
441
|
ChiSquare,
|
|
435
442
|
CipherSaber2Decrypt,
|
|
@@ -574,6 +581,8 @@ export {
|
|
|
574
581
|
Keccak,
|
|
575
582
|
LS47Decrypt,
|
|
576
583
|
LS47Encrypt,
|
|
584
|
+
LZStringCompress,
|
|
585
|
+
LZStringDecompress,
|
|
577
586
|
Label,
|
|
578
587
|
Lorenz,
|
|
579
588
|
LuhnChecksum,
|
|
@@ -635,6 +644,7 @@ export {
|
|
|
635
644
|
ROT13BruteForce,
|
|
636
645
|
ROT47,
|
|
637
646
|
ROT47BruteForce,
|
|
647
|
+
ROT8000,
|
|
638
648
|
RSADecrypt,
|
|
639
649
|
RSAEncrypt,
|
|
640
650
|
RSASign,
|
package/src/node/index.mjs
CHANGED
|
@@ -60,6 +60,8 @@ import {
|
|
|
60
60
|
CTPH as core_CTPH,
|
|
61
61
|
CaesarBoxCipher as core_CaesarBoxCipher,
|
|
62
62
|
CartesianProduct as core_CartesianProduct,
|
|
63
|
+
CetaceanCipherDecode as core_CetaceanCipherDecode,
|
|
64
|
+
CetaceanCipherEncode as core_CetaceanCipherEncode,
|
|
63
65
|
ChangeIPFormat as core_ChangeIPFormat,
|
|
64
66
|
ChiSquare as core_ChiSquare,
|
|
65
67
|
CipherSaber2Decrypt as core_CipherSaber2Decrypt,
|
|
@@ -197,6 +199,8 @@ import {
|
|
|
197
199
|
Keccak as core_Keccak,
|
|
198
200
|
LS47Decrypt as core_LS47Decrypt,
|
|
199
201
|
LS47Encrypt as core_LS47Encrypt,
|
|
202
|
+
LZStringCompress as core_LZStringCompress,
|
|
203
|
+
LZStringDecompress as core_LZStringDecompress,
|
|
200
204
|
Lorenz as core_Lorenz,
|
|
201
205
|
LuhnChecksum as core_LuhnChecksum,
|
|
202
206
|
MD2 as core_MD2,
|
|
@@ -256,6 +260,7 @@ import {
|
|
|
256
260
|
ROT13BruteForce as core_ROT13BruteForce,
|
|
257
261
|
ROT47 as core_ROT47,
|
|
258
262
|
ROT47BruteForce as core_ROT47BruteForce,
|
|
263
|
+
ROT8000 as core_ROT8000,
|
|
259
264
|
RSADecrypt as core_RSADecrypt,
|
|
260
265
|
RSAEncrypt as core_RSAEncrypt,
|
|
261
266
|
RSASign as core_RSASign,
|
|
@@ -440,6 +445,8 @@ function generateChef() {
|
|
|
440
445
|
"CTPH": _wrap(core_CTPH),
|
|
441
446
|
"caesarBoxCipher": _wrap(core_CaesarBoxCipher),
|
|
442
447
|
"cartesianProduct": _wrap(core_CartesianProduct),
|
|
448
|
+
"cetaceanCipherDecode": _wrap(core_CetaceanCipherDecode),
|
|
449
|
+
"cetaceanCipherEncode": _wrap(core_CetaceanCipherEncode),
|
|
443
450
|
"changeIPFormat": _wrap(core_ChangeIPFormat),
|
|
444
451
|
"chiSquare": _wrap(core_ChiSquare),
|
|
445
452
|
"cipherSaber2Decrypt": _wrap(core_CipherSaber2Decrypt),
|
|
@@ -577,6 +584,8 @@ function generateChef() {
|
|
|
577
584
|
"keccak": _wrap(core_Keccak),
|
|
578
585
|
"LS47Decrypt": _wrap(core_LS47Decrypt),
|
|
579
586
|
"LS47Encrypt": _wrap(core_LS47Encrypt),
|
|
587
|
+
"LZStringCompress": _wrap(core_LZStringCompress),
|
|
588
|
+
"LZStringDecompress": _wrap(core_LZStringDecompress),
|
|
580
589
|
"lorenz": _wrap(core_Lorenz),
|
|
581
590
|
"luhnChecksum": _wrap(core_LuhnChecksum),
|
|
582
591
|
"MD2": _wrap(core_MD2),
|
|
@@ -636,6 +645,7 @@ function generateChef() {
|
|
|
636
645
|
"ROT13BruteForce": _wrap(core_ROT13BruteForce),
|
|
637
646
|
"ROT47": _wrap(core_ROT47),
|
|
638
647
|
"ROT47BruteForce": _wrap(core_ROT47BruteForce),
|
|
648
|
+
"ROT8000": _wrap(core_ROT8000),
|
|
639
649
|
"RSADecrypt": _wrap(core_RSADecrypt),
|
|
640
650
|
"RSAEncrypt": _wrap(core_RSAEncrypt),
|
|
641
651
|
"RSASign": _wrap(core_RSASign),
|
|
@@ -828,6 +838,8 @@ const CSVToJSON = chef.CSVToJSON;
|
|
|
828
838
|
const CTPH = chef.CTPH;
|
|
829
839
|
const caesarBoxCipher = chef.caesarBoxCipher;
|
|
830
840
|
const cartesianProduct = chef.cartesianProduct;
|
|
841
|
+
const cetaceanCipherDecode = chef.cetaceanCipherDecode;
|
|
842
|
+
const cetaceanCipherEncode = chef.cetaceanCipherEncode;
|
|
831
843
|
const changeIPFormat = chef.changeIPFormat;
|
|
832
844
|
const chiSquare = chef.chiSquare;
|
|
833
845
|
const cipherSaber2Decrypt = chef.cipherSaber2Decrypt;
|
|
@@ -972,6 +984,8 @@ const jump = chef.jump;
|
|
|
972
984
|
const keccak = chef.keccak;
|
|
973
985
|
const LS47Decrypt = chef.LS47Decrypt;
|
|
974
986
|
const LS47Encrypt = chef.LS47Encrypt;
|
|
987
|
+
const LZStringCompress = chef.LZStringCompress;
|
|
988
|
+
const LZStringDecompress = chef.LZStringDecompress;
|
|
975
989
|
const label = chef.label;
|
|
976
990
|
const lorenz = chef.lorenz;
|
|
977
991
|
const luhnChecksum = chef.luhnChecksum;
|
|
@@ -1033,6 +1047,7 @@ const ROT13 = chef.ROT13;
|
|
|
1033
1047
|
const ROT13BruteForce = chef.ROT13BruteForce;
|
|
1034
1048
|
const ROT47 = chef.ROT47;
|
|
1035
1049
|
const ROT47BruteForce = chef.ROT47BruteForce;
|
|
1050
|
+
const ROT8000 = chef.ROT8000;
|
|
1036
1051
|
const RSADecrypt = chef.RSADecrypt;
|
|
1037
1052
|
const RSAEncrypt = chef.RSAEncrypt;
|
|
1038
1053
|
const RSASign = chef.RSASign;
|
|
@@ -1210,6 +1225,8 @@ const operations = [
|
|
|
1210
1225
|
CTPH,
|
|
1211
1226
|
caesarBoxCipher,
|
|
1212
1227
|
cartesianProduct,
|
|
1228
|
+
cetaceanCipherDecode,
|
|
1229
|
+
cetaceanCipherEncode,
|
|
1213
1230
|
changeIPFormat,
|
|
1214
1231
|
chiSquare,
|
|
1215
1232
|
cipherSaber2Decrypt,
|
|
@@ -1354,6 +1371,8 @@ const operations = [
|
|
|
1354
1371
|
keccak,
|
|
1355
1372
|
LS47Decrypt,
|
|
1356
1373
|
LS47Encrypt,
|
|
1374
|
+
LZStringCompress,
|
|
1375
|
+
LZStringDecompress,
|
|
1357
1376
|
label,
|
|
1358
1377
|
lorenz,
|
|
1359
1378
|
luhnChecksum,
|
|
@@ -1415,6 +1434,7 @@ const operations = [
|
|
|
1415
1434
|
ROT13BruteForce,
|
|
1416
1435
|
ROT47,
|
|
1417
1436
|
ROT47BruteForce,
|
|
1437
|
+
ROT8000,
|
|
1418
1438
|
RSADecrypt,
|
|
1419
1439
|
RSAEncrypt,
|
|
1420
1440
|
RSASign,
|
|
@@ -1596,6 +1616,8 @@ export {
|
|
|
1596
1616
|
CTPH,
|
|
1597
1617
|
caesarBoxCipher,
|
|
1598
1618
|
cartesianProduct,
|
|
1619
|
+
cetaceanCipherDecode,
|
|
1620
|
+
cetaceanCipherEncode,
|
|
1599
1621
|
changeIPFormat,
|
|
1600
1622
|
chiSquare,
|
|
1601
1623
|
cipherSaber2Decrypt,
|
|
@@ -1740,6 +1762,8 @@ export {
|
|
|
1740
1762
|
keccak,
|
|
1741
1763
|
LS47Decrypt,
|
|
1742
1764
|
LS47Encrypt,
|
|
1765
|
+
LZStringCompress,
|
|
1766
|
+
LZStringDecompress,
|
|
1743
1767
|
label,
|
|
1744
1768
|
lorenz,
|
|
1745
1769
|
luhnChecksum,
|
|
@@ -1801,6 +1825,7 @@ export {
|
|
|
1801
1825
|
ROT13BruteForce,
|
|
1802
1826
|
ROT47,
|
|
1803
1827
|
ROT47BruteForce,
|
|
1828
|
+
ROT8000,
|
|
1804
1829
|
RSADecrypt,
|
|
1805
1830
|
RSAEncrypt,
|
|
1806
1831
|
RSASign,
|
package/tests/browser/ops.js
CHANGED
|
@@ -249,6 +249,7 @@ module.exports = {
|
|
|
249
249
|
// testOp(browser, "RIPEMD", "test input", "test_output");
|
|
250
250
|
// testOp(browser, "ROT13", "test input", "test_output");
|
|
251
251
|
// testOp(browser, "ROT47", "test input", "test_output");
|
|
252
|
+
// testOp(browser, "ROT8000", "test input", "test_output");
|
|
252
253
|
// testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
|
|
253
254
|
// testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
|
|
254
255
|
// testOp(browser, "Randomize Colour Palette", "test input", "test_output");
|
|
@@ -28,6 +28,8 @@ import "./tests/Base85.mjs";
|
|
|
28
28
|
import "./tests/BitwiseOp.mjs";
|
|
29
29
|
import "./tests/ByteRepr.mjs";
|
|
30
30
|
import "./tests/CartesianProduct.mjs";
|
|
31
|
+
import "./tests/CetaceanCipherEncode.mjs";
|
|
32
|
+
import "./tests/CetaceanCipherDecode.mjs";
|
|
31
33
|
import "./tests/CharEnc.mjs";
|
|
32
34
|
import "./tests/ChangeIPFormat.mjs";
|
|
33
35
|
import "./tests/Charts.mjs";
|
|
@@ -118,6 +120,7 @@ import "./tests/ELFInfo.mjs";
|
|
|
118
120
|
import "./tests/Subsection.mjs";
|
|
119
121
|
import "./tests/CaesarBoxCipher.mjs";
|
|
120
122
|
import "./tests/LS47.mjs";
|
|
123
|
+
import "./tests/LZString.mjs";
|
|
121
124
|
|
|
122
125
|
|
|
123
126
|
// Cannot test operations that use the File type yet
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CetaceanCipher Encode tests
|
|
3
|
+
*
|
|
4
|
+
* @author dolphinOnKeys
|
|
5
|
+
* @copyright Crown Copyright 2022
|
|
6
|
+
* @licence Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
name: "Cetacean Cipher Decode",
|
|
13
|
+
input: "EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
|
|
14
|
+
expectedOutput: "a b c で",
|
|
15
|
+
recipeConfig: [
|
|
16
|
+
{
|
|
17
|
+
op: "Cetacean Cipher Decode",
|
|
18
|
+
args: []
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
}
|
|
22
|
+
]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CetaceanCipher Encode tests
|
|
3
|
+
*
|
|
4
|
+
* @author dolphinOnKeys
|
|
5
|
+
* @copyright Crown Copyright 2022
|
|
6
|
+
* @licence Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
name: "Cetacean Cipher Encode",
|
|
13
|
+
input: "a b c で",
|
|
14
|
+
expectedOutput: "EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
|
|
15
|
+
recipeConfig: [
|
|
16
|
+
{
|
|
17
|
+
op: "Cetacean Cipher Encode",
|
|
18
|
+
args: []
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
}
|
|
22
|
+
]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LZString tests.
|
|
3
|
+
*
|
|
4
|
+
* @author crespyl [peter@crespyl.net]
|
|
5
|
+
* @copyright Peter Jacobs 2021
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
name: "LZString Compress To Base64",
|
|
13
|
+
input: "hello world",
|
|
14
|
+
expectedOutput: "BYUwNmD2AEDukCcwBMg=",
|
|
15
|
+
recipeConfig: [
|
|
16
|
+
{
|
|
17
|
+
"op": "LZString Compress",
|
|
18
|
+
"args": ["Base64"]
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "LZString Decompress From Base64",
|
|
24
|
+
input: "BYUwNmD2AEDukCcwBMg=",
|
|
25
|
+
expectedOutput: "hello world",
|
|
26
|
+
recipeConfig: [
|
|
27
|
+
{
|
|
28
|
+
"op": "LZString Decompress",
|
|
29
|
+
"args": ["Base64"]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
]);
|
|
@@ -212,4 +212,37 @@ TestRegister.addTests([
|
|
|
212
212
|
},
|
|
213
213
|
],
|
|
214
214
|
},
|
|
215
|
+
{
|
|
216
|
+
name: "ROT8000: nothing",
|
|
217
|
+
input: "",
|
|
218
|
+
expectedOutput: "",
|
|
219
|
+
recipeConfig: [
|
|
220
|
+
{
|
|
221
|
+
op: "ROT8000",
|
|
222
|
+
args: []
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "ROT8000: normal",
|
|
228
|
+
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
|
229
|
+
expectedOutput: "籝籱籮 籚籾籲籬籴 籋类籸粀籷 籏籸粁 籓籾籶籹籮籭 籘籿籮类 籝籱籮 籕籪粃粂 籍籸籰簷",
|
|
230
|
+
recipeConfig: [
|
|
231
|
+
{
|
|
232
|
+
op: "ROT8000",
|
|
233
|
+
args: []
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "ROT8000: backward",
|
|
239
|
+
input: "籝籱籮 籚籾籲籬籴 籋类籸粀籷 籏籸粁 籓籾籶籹籮籭 籘籿籮类 籝籱籮 籕籪粃粂 籍籸籰簷",
|
|
240
|
+
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
|
241
|
+
recipeConfig: [
|
|
242
|
+
{
|
|
243
|
+
op: "ROT8000",
|
|
244
|
+
args: []
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
215
248
|
]);
|