cyberchef 9.50.12 → 9.52.1

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.
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @author joostrijneveld [joost@joostrijneveld.nl]
3
+ * @copyright Crown Copyright 2022
4
+ * @license Apache-2.0
5
+ */
6
+
7
+ import Operation from "../Operation.mjs";
8
+ import OperationError from "../errors/OperationError.mjs";
9
+ import Utils from "../Utils.mjs";
10
+ import { toHex } from "../lib/Hex.mjs";
11
+
12
+ /**
13
+ * Computes the ChaCha block function
14
+ *
15
+ * @param {byteArray} key
16
+ * @param {byteArray} nonce
17
+ * @param {byteArray} counter
18
+ * @param {integer} rounds
19
+ * @returns {byteArray}
20
+ */
21
+ function chacha(key, nonce, counter, rounds) {
22
+ const tau = "expand 16-byte k";
23
+ const sigma = "expand 32-byte k";
24
+
25
+ let state, c;
26
+ if (key.length === 16) {
27
+ c = Utils.strToByteArray(tau);
28
+ state = c.concat(key).concat(key);
29
+ } else {
30
+ c = Utils.strToByteArray(sigma);
31
+ state = c.concat(key);
32
+ }
33
+ state = state.concat(counter).concat(nonce);
34
+
35
+ const x = Array();
36
+ for (let i = 0; i < 64; i += 4) {
37
+ x.push(Utils.byteArrayToInt(state.slice(i, i + 4), "little"));
38
+ }
39
+ const a = [...x];
40
+
41
+ /**
42
+ * Macro to compute a 32-bit rotate-left operation
43
+ *
44
+ * @param {integer} x
45
+ * @param {integer} n
46
+ * @returns {integer}
47
+ */
48
+ function ROL32(x, n) {
49
+ return ((x << n) & 0xFFFFFFFF) | (x >>> (32 - n));
50
+ }
51
+
52
+ /**
53
+ * Macro to compute a single ChaCha quarterround operation
54
+ *
55
+ * @param {integer} x
56
+ * @param {integer} a
57
+ * @param {integer} b
58
+ * @param {integer} c
59
+ * @param {integer} d
60
+ * @returns {integer}
61
+ */
62
+ function quarterround(x, a, b, c, d) {
63
+ x[a] = ((x[a] + x[b]) & 0xFFFFFFFF); x[d] = ROL32(x[d] ^ x[a], 16);
64
+ x[c] = ((x[c] + x[d]) & 0xFFFFFFFF); x[b] = ROL32(x[b] ^ x[c], 12);
65
+ x[a] = ((x[a] + x[b]) & 0xFFFFFFFF); x[d] = ROL32(x[d] ^ x[a], 8);
66
+ x[c] = ((x[c] + x[d]) & 0xFFFFFFFF); x[b] = ROL32(x[b] ^ x[c], 7);
67
+ }
68
+
69
+ for (let i = 0; i < rounds / 2; i++) {
70
+ quarterround(x, 0, 4, 8, 12);
71
+ quarterround(x, 1, 5, 9, 13);
72
+ quarterround(x, 2, 6, 10, 14);
73
+ quarterround(x, 3, 7, 11, 15);
74
+ quarterround(x, 0, 5, 10, 15);
75
+ quarterround(x, 1, 6, 11, 12);
76
+ quarterround(x, 2, 7, 8, 13);
77
+ quarterround(x, 3, 4, 9, 14);
78
+ }
79
+
80
+ for (let i = 0; i < 16; i++) {
81
+ x[i] = (x[i] + a[i]) & 0xFFFFFFFF;
82
+ }
83
+
84
+ let output = Array();
85
+ for (let i = 0; i < 16; i++) {
86
+ output = output.concat(Utils.intToByteArray(x[i], 4, "little"));
87
+ }
88
+ return output;
89
+ }
90
+
91
+ /**
92
+ * ChaCha operation
93
+ */
94
+ class ChaCha extends Operation {
95
+
96
+ /**
97
+ * ChaCha constructor
98
+ */
99
+ constructor() {
100
+ super();
101
+
102
+ this.name = "ChaCha";
103
+ this.module = "Default";
104
+ this.description = "ChaCha is a stream cipher designed by Daniel J. Bernstein. It is a variant of the Salsa stream cipher. Several parameterizations exist; 'ChaCha' may refer to the original construction, or to the variant as described in RFC-8439. ChaCha is often used with Poly1305, in the ChaCha20-Poly1305 AEAD construction.<br><br><b>Key:</b> ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).<br><br><b>Nonce:</b> ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).<br><br><b>Counter:</b> ChaCha uses a counter of 4 or 8 bytes (32 or 64 bits); together, the nonce and counter must add up to 16 bytes. The counter starts at zero at the start of the keystream, and is incremented at every 64 bytes.";
105
+ this.infoURL = "https://wikipedia.org/wiki/Salsa20#ChaCha_variant";
106
+ this.inputType = "string";
107
+ this.outputType = "string";
108
+ this.args = [
109
+ {
110
+ "name": "Key",
111
+ "type": "toggleString",
112
+ "value": "",
113
+ "toggleValues": ["Hex", "UTF8", "Latin1", "Base64"]
114
+ },
115
+ {
116
+ "name": "Nonce",
117
+ "type": "toggleString",
118
+ "value": "",
119
+ "toggleValues": ["Hex", "UTF8", "Latin1", "Base64", "Integer"]
120
+ },
121
+ {
122
+ "name": "Counter",
123
+ "type": "number",
124
+ "value": 0,
125
+ "min": 0
126
+ },
127
+ {
128
+ "name": "Rounds",
129
+ "type": "option",
130
+ "value": ["20", "12", "8"]
131
+ },
132
+ {
133
+ "name": "Input",
134
+ "type": "option",
135
+ "value": ["Hex", "Raw"]
136
+ },
137
+ {
138
+ "name": "Output",
139
+ "type": "option",
140
+ "value": ["Raw", "Hex"]
141
+ }
142
+ ];
143
+ }
144
+
145
+ /**
146
+ * @param {string} input
147
+ * @param {Object[]} args
148
+ * @returns {string}
149
+ */
150
+ run(input, args) {
151
+ const key = Utils.convertToByteArray(args[0].string, args[0].option),
152
+ nonceType = args[1].option,
153
+ rounds = parseInt(args[3], 10),
154
+ inputType = args[4],
155
+ outputType = args[5];
156
+
157
+ if (key.length !== 16 && key.length !== 32) {
158
+ throw new OperationError(`Invalid key length: ${key.length} bytes.
159
+
160
+ ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).`);
161
+ }
162
+
163
+ let counter, nonce, counterLength;
164
+ if (nonceType === "Integer") {
165
+ nonce = Utils.intToByteArray(parseInt(args[1].string, 10), 12, "little");
166
+ counterLength = 4;
167
+ } else {
168
+ nonce = Utils.convertToByteArray(args[1].string, args[1].option);
169
+ if (!(nonce.length === 12 || nonce.length === 8)) {
170
+ throw new OperationError(`Invalid nonce length: ${nonce.length} bytes.
171
+
172
+ ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`);
173
+ }
174
+ counterLength = 16 - nonce.length;
175
+ }
176
+ counter = Utils.intToByteArray(args[2], counterLength, "little");
177
+
178
+ const output = [];
179
+ input = Utils.convertToByteArray(input, inputType);
180
+
181
+ let counterAsInt = Utils.byteArrayToInt(counter, "little");
182
+ for (let i = 0; i < input.length; i += 64) {
183
+ counter = Utils.intToByteArray(counterAsInt, counterLength, "little");
184
+ const stream = chacha(key, nonce, counter, rounds);
185
+ for (let j = 0; j < 64 && i + j < input.length; j++) {
186
+ output.push(input[i + j] ^ stream[j]);
187
+ }
188
+ counterAsInt++;
189
+ }
190
+
191
+ if (outputType === "Hex") {
192
+ return toHex(output);
193
+ } else {
194
+ return Utils.arrayBufferToStr(output);
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Highlight ChaCha
200
+ *
201
+ * @param {Object[]} pos
202
+ * @param {number} pos[].start
203
+ * @param {number} pos[].end
204
+ * @param {Object[]} args
205
+ * @returns {Object[]} pos
206
+ */
207
+ highlight(pos, args) {
208
+ const inputType = args[4],
209
+ outputType = args[5];
210
+ if (inputType === "Raw" && outputType === "Raw") {
211
+ return pos;
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Highlight ChaCha in reverse
217
+ *
218
+ * @param {Object[]} pos
219
+ * @param {number} pos[].start
220
+ * @param {number} pos[].end
221
+ * @param {Object[]} args
222
+ * @returns {Object[]} pos
223
+ */
224
+ highlightReverse(pos, args) {
225
+ const inputType = args[4],
226
+ outputType = args[5];
227
+ if (inputType === "Raw" && outputType === "Raw") {
228
+ return pos;
229
+ }
230
+ }
231
+
232
+ }
233
+
234
+ export default ChaCha;
@@ -7,7 +7,7 @@
7
7
  import Operation from "../Operation.mjs";
8
8
  import OperationError from "../errors/OperationError.mjs";
9
9
  import Utils from "../Utils.mjs";
10
- import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs";
10
+ import {ALPHABET_OPTIONS} from "../lib/Base85.mjs";
11
11
 
12
12
  /**
13
13
  * From Base85 operation
@@ -37,6 +37,12 @@ class FromBase85 extends Operation {
37
37
  type: "boolean",
38
38
  value: true
39
39
  },
40
+ {
41
+ name: "All-zero group char",
42
+ type: "binaryShortString",
43
+ value: "z",
44
+ maxLength: 1
45
+ }
40
46
  ];
41
47
  this.checks = [
42
48
  {
@@ -76,8 +82,8 @@ class FromBase85 extends Operation {
76
82
  */
77
83
  run(input, args) {
78
84
  const alphabet = Utils.expandAlphRange(args[0]).join(""),
79
- encoding = alphabetName(alphabet),
80
85
  removeNonAlphChars = args[1],
86
+ allZeroGroupChar = typeof args[2] === "string" ? args[2].slice(0, 1) : "",
81
87
  result = [];
82
88
 
83
89
  if (alphabet.length !== 85 ||
@@ -85,14 +91,21 @@ class FromBase85 extends Operation {
85
91
  throw new OperationError("Alphabet must be of length 85");
86
92
  }
87
93
 
94
+ if (allZeroGroupChar && alphabet.includes(allZeroGroupChar)) {
95
+ throw new OperationError("The all-zero group char cannot appear in the alphabet");
96
+ }
97
+
88
98
  // Remove delimiters if present
89
99
  const matches = input.match(/^<~(.+?)~>$/);
90
100
  if (matches !== null) input = matches[1];
91
101
 
92
102
  // Remove non-alphabet characters
93
103
  if (removeNonAlphChars) {
94
- const re = new RegExp("[^" + alphabet.replace(/[[\]\\\-^$]/g, "\\$&") + "]", "g");
104
+ const re = new RegExp("[^~" + allZeroGroupChar +alphabet.replace(/[[\]\\\-^$]/g, "\\$&") + "]", "g");
95
105
  input = input.replace(re, "");
106
+ // Remove delimiters again if present (incase of non-alphabet characters in front/behind delimiters)
107
+ const matches = input.match(/^<~(.+?)~>$/);
108
+ if (matches !== null) input = matches[1];
96
109
  }
97
110
 
98
111
  if (input.length === 0) return [];
@@ -100,7 +113,7 @@ class FromBase85 extends Operation {
100
113
  let i = 0;
101
114
  let block, blockBytes;
102
115
  while (i < input.length) {
103
- if (encoding === "Standard" && input[i] === "z") {
116
+ if (input[i] === allZeroGroupChar) {
104
117
  result.push(0, 0, 0, 0);
105
118
  i++;
106
119
  } else {
@@ -110,7 +123,7 @@ class FromBase85 extends Operation {
110
123
  .split("")
111
124
  .map((chr, idx) => {
112
125
  const digit = alphabet.indexOf(chr);
113
- if (digit < 0 || digit > 84) {
126
+ if ((digit < 0 || digit > 84) && chr !== allZeroGroupChar) {
114
127
  throw `Invalid character '${chr}' at index ${i + idx}`;
115
128
  }
116
129
  return digit;
@@ -40,6 +40,7 @@ import Bzip2Compress from "./Bzip2Compress.mjs";
40
40
  import Bzip2Decompress from "./Bzip2Decompress.mjs";
41
41
  import CBORDecode from "./CBORDecode.mjs";
42
42
  import CBOREncode from "./CBOREncode.mjs";
43
+ import CMAC from "./CMAC.mjs";
43
44
  import CRC16Checksum from "./CRC16Checksum.mjs";
44
45
  import CRC32Checksum from "./CRC32Checksum.mjs";
45
46
  import CRC8Checksum from "./CRC8Checksum.mjs";
@@ -52,6 +53,7 @@ import CaesarBoxCipher from "./CaesarBoxCipher.mjs";
52
53
  import CartesianProduct from "./CartesianProduct.mjs";
53
54
  import CetaceanCipherDecode from "./CetaceanCipherDecode.mjs";
54
55
  import CetaceanCipherEncode from "./CetaceanCipherEncode.mjs";
56
+ import ChaCha from "./ChaCha.mjs";
55
57
  import ChangeIPFormat from "./ChangeIPFormat.mjs";
56
58
  import ChiSquare from "./ChiSquare.mjs";
57
59
  import CipherSaber2Decrypt from "./CipherSaber2Decrypt.mjs";
@@ -432,6 +434,7 @@ export {
432
434
  Bzip2Decompress,
433
435
  CBORDecode,
434
436
  CBOREncode,
437
+ CMAC,
435
438
  CRC16Checksum,
436
439
  CRC32Checksum,
437
440
  CRC8Checksum,
@@ -444,6 +447,7 @@ export {
444
447
  CartesianProduct,
445
448
  CetaceanCipherDecode,
446
449
  CetaceanCipherEncode,
450
+ ChaCha,
447
451
  ChangeIPFormat,
448
452
  ChiSquare,
449
453
  CipherSaber2Decrypt,
@@ -50,6 +50,7 @@ import {
50
50
  Bzip2Decompress as core_Bzip2Decompress,
51
51
  CBORDecode as core_CBORDecode,
52
52
  CBOREncode as core_CBOREncode,
53
+ CMAC as core_CMAC,
53
54
  CRC16Checksum as core_CRC16Checksum,
54
55
  CRC32Checksum as core_CRC32Checksum,
55
56
  CRC8Checksum as core_CRC8Checksum,
@@ -62,6 +63,7 @@ import {
62
63
  CartesianProduct as core_CartesianProduct,
63
64
  CetaceanCipherDecode as core_CetaceanCipherDecode,
64
65
  CetaceanCipherEncode as core_CetaceanCipherEncode,
66
+ ChaCha as core_ChaCha,
65
67
  ChangeIPFormat as core_ChangeIPFormat,
66
68
  ChiSquare as core_ChiSquare,
67
69
  CipherSaber2Decrypt as core_CipherSaber2Decrypt,
@@ -442,6 +444,7 @@ function generateChef() {
442
444
  "bzip2Decompress": _wrap(core_Bzip2Decompress),
443
445
  "CBORDecode": _wrap(core_CBORDecode),
444
446
  "CBOREncode": _wrap(core_CBOREncode),
447
+ "CMAC": _wrap(core_CMAC),
445
448
  "CRC16Checksum": _wrap(core_CRC16Checksum),
446
449
  "CRC32Checksum": _wrap(core_CRC32Checksum),
447
450
  "CRC8Checksum": _wrap(core_CRC8Checksum),
@@ -454,6 +457,7 @@ function generateChef() {
454
457
  "cartesianProduct": _wrap(core_CartesianProduct),
455
458
  "cetaceanCipherDecode": _wrap(core_CetaceanCipherDecode),
456
459
  "cetaceanCipherEncode": _wrap(core_CetaceanCipherEncode),
460
+ "chaCha": _wrap(core_ChaCha),
457
461
  "changeIPFormat": _wrap(core_ChangeIPFormat),
458
462
  "chiSquare": _wrap(core_ChiSquare),
459
463
  "cipherSaber2Decrypt": _wrap(core_CipherSaber2Decrypt),
@@ -842,6 +846,7 @@ const bzip2Compress = chef.bzip2Compress;
842
846
  const bzip2Decompress = chef.bzip2Decompress;
843
847
  const CBORDecode = chef.CBORDecode;
844
848
  const CBOREncode = chef.CBOREncode;
849
+ const CMAC = chef.CMAC;
845
850
  const CRC16Checksum = chef.CRC16Checksum;
846
851
  const CRC32Checksum = chef.CRC32Checksum;
847
852
  const CRC8Checksum = chef.CRC8Checksum;
@@ -854,6 +859,7 @@ const caesarBoxCipher = chef.caesarBoxCipher;
854
859
  const cartesianProduct = chef.cartesianProduct;
855
860
  const cetaceanCipherDecode = chef.cetaceanCipherDecode;
856
861
  const cetaceanCipherEncode = chef.cetaceanCipherEncode;
862
+ const chaCha = chef.chaCha;
857
863
  const changeIPFormat = chef.changeIPFormat;
858
864
  const chiSquare = chef.chiSquare;
859
865
  const cipherSaber2Decrypt = chef.cipherSaber2Decrypt;
@@ -1236,6 +1242,7 @@ const operations = [
1236
1242
  bzip2Decompress,
1237
1243
  CBORDecode,
1238
1244
  CBOREncode,
1245
+ CMAC,
1239
1246
  CRC16Checksum,
1240
1247
  CRC32Checksum,
1241
1248
  CRC8Checksum,
@@ -1248,6 +1255,7 @@ const operations = [
1248
1255
  cartesianProduct,
1249
1256
  cetaceanCipherDecode,
1250
1257
  cetaceanCipherEncode,
1258
+ chaCha,
1251
1259
  changeIPFormat,
1252
1260
  chiSquare,
1253
1261
  cipherSaber2Decrypt,
@@ -1634,6 +1642,7 @@ export {
1634
1642
  bzip2Decompress,
1635
1643
  CBORDecode,
1636
1644
  CBOREncode,
1645
+ CMAC,
1637
1646
  CRC16Checksum,
1638
1647
  CRC32Checksum,
1639
1648
  CRC8Checksum,
@@ -1646,6 +1655,7 @@ export {
1646
1655
  cartesianProduct,
1647
1656
  cetaceanCipherDecode,
1648
1657
  cetaceanCipherEncode,
1658
+ chaCha,
1649
1659
  changeIPFormat,
1650
1660
  chiSquare,
1651
1661
  cipherSaber2Decrypt,
@@ -30,6 +30,7 @@ class HTMLIngredient {
30
30
  this.rows = config.rows || false;
31
31
  this.target = config.target;
32
32
  this.defaultIndex = config.defaultIndex || 0;
33
+ this.maxLength = config.maxLength || null;
33
34
  this.toggleValues = config.toggleValues;
34
35
  this.ingId = this.app.nextIngId();
35
36
  this.id = "ing-" + this.ingId;
@@ -63,7 +64,8 @@ class HTMLIngredient {
63
64
  tabindex="${this.tabIndex}"
64
65
  arg-name="${this.name}"
65
66
  value="${this.value}"
66
- ${this.disabled ? "disabled" : ""}>
67
+ ${this.disabled ? "disabled" : ""}
68
+ ${this.maxLength ? `maxlength="${this.maxLength}"` : ""}>
67
69
  </div>`;
68
70
  break;
69
71
  case "shortString":
@@ -78,7 +80,8 @@ class HTMLIngredient {
78
80
  tabindex="${this.tabIndex}"
79
81
  arg-name="${this.name}"
80
82
  value="${this.value}"
81
- ${this.disabled ? "disabled" : ""}>
83
+ ${this.disabled ? "disabled" : ""}
84
+ ${this.maxLength ? `maxlength="${this.maxLength}"` : ""}>
82
85
  </div>`;
83
86
  break;
84
87
  case "toggleString":
@@ -93,7 +96,8 @@ class HTMLIngredient {
93
96
  tabindex="${this.tabIndex}"
94
97
  arg-name="${this.name}"
95
98
  value="${this.value}"
96
- ${this.disabled ? "disabled" : ""}>
99
+ ${this.disabled ? "disabled" : ""}
100
+ ${this.maxLength ? `maxlength="${this.maxLength}"` : ""}>
97
101
  </div>
98
102
  <div class="input-group-append">
99
103
  <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">${this.toggleValues[0]}</button>
@@ -30,6 +30,7 @@ import "./tests/ByteRepr.mjs";
30
30
  import "./tests/CartesianProduct.mjs";
31
31
  import "./tests/CetaceanCipherEncode.mjs";
32
32
  import "./tests/CetaceanCipherDecode.mjs";
33
+ import "./tests/ChaCha.mjs";
33
34
  import "./tests/CharEnc.mjs";
34
35
  import "./tests/ChangeIPFormat.mjs";
35
36
  import "./tests/Charts.mjs";
@@ -126,6 +127,7 @@ import "./tests/LZString.mjs";
126
127
  import "./tests/NTLM.mjs";
127
128
  import "./tests/Shuffle.mjs";
128
129
  import "./tests/FletcherChecksum.mjs";
130
+ import "./tests/CMAC.mjs";
129
131
 
130
132
  // Cannot test operations that use the File type yet
131
133
  // import "./tests/SplitColourChannels.mjs";
@@ -16,6 +16,10 @@ DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIal(\
16
16
  DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G>u\
17
17
  D.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";
18
18
 
19
+ const allZeroExample = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
20
+
21
+ const allZeroOutput = "zz!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm5X@_(6q'R884cEH9MJ8X:f1+h<)lt#=BSg3>[:ZC?t!MSA7]@cBPD3sCi+'.E,fo>FEMbNG^4U^I!pHnJ:W<)KS>/9Ll%\"IN/`jYOHG]iPa.Q$R$jD4S=Q7DTV8*TUnsrdW2ZetXKAY/Yd(L?['d?O\\@K2_]Y2%o^qmn*`5Ta:aN;TJbg\"GZd*^:jeCE.%f\\,!5gtgiEi8N\\UjQ5OekiqBum-X60nF?)@o_%qPq\"ad`r;HWp";
22
+
19
23
  TestRegister.addTests([
20
24
  {
21
25
  name: "To Base85",
@@ -45,4 +49,22 @@ TestRegister.addTests([
45
49
  "args": ["!-u", false] }
46
50
  ]
47
51
  },
52
+ {
53
+ name: "To Base85",
54
+ input: allZeroExample,
55
+ expectedOutput: allZeroOutput,
56
+ recipeConfig: [
57
+ { "op": "To Base85",
58
+ "args": ["!-u"] }
59
+ ]
60
+ },
61
+ {
62
+ name: "From Base85",
63
+ input: allZeroOutput,
64
+ expectedOutput: allZeroExample,
65
+ recipeConfig: [
66
+ { "op": "From Base85",
67
+ "args": ["!-u", true, "z"] }
68
+ ]
69
+ },
48
70
  ]);