cyberchef 9.52.1 → 9.54.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 +10 -0
- package/package.json +1 -1
- package/src/core/config/Categories.json +4 -1
- package/src/core/config/OperationConfig.json +155 -0
- package/src/core/config/modules/Ciphers.mjs +6 -0
- package/src/core/operations/AESKeyUnwrap.mjs +128 -0
- package/src/core/operations/AESKeyWrap.mjs +115 -0
- package/src/core/operations/Rabbit.mjs +247 -0
- package/src/core/operations/index.mjs +6 -0
- package/src/node/index.mjs +15 -0
- package/tests/operations/index.mjs +2 -0
- package/tests/operations/tests/AESKeyWrap.mjs +324 -0
- package/tests/operations/tests/Rabbit.mjs +177 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author mikecat
|
|
3
|
+
* @copyright Crown Copyright 2022
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
7
|
+
|
|
8
|
+
TestRegister.addTests([
|
|
9
|
+
{
|
|
10
|
+
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
|
11
|
+
"input": "00112233445566778899aabbccddeeff",
|
|
12
|
+
"expectedOutput": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
|
13
|
+
"recipeConfig": [
|
|
14
|
+
{
|
|
15
|
+
"op": "AES Key Wrap",
|
|
16
|
+
"args": [
|
|
17
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
18
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
19
|
+
"Hex", "Hex"
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
|
26
|
+
"input": "00112233445566778899aabbccddeeff",
|
|
27
|
+
"expectedOutput": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
|
28
|
+
"recipeConfig": [
|
|
29
|
+
{
|
|
30
|
+
"op": "AES Key Wrap",
|
|
31
|
+
"args": [
|
|
32
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
|
33
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
34
|
+
"Hex", "Hex"
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
|
41
|
+
"input": "00112233445566778899aabbccddeeff",
|
|
42
|
+
"expectedOutput": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
|
43
|
+
"recipeConfig": [
|
|
44
|
+
{
|
|
45
|
+
"op": "AES Key Wrap",
|
|
46
|
+
"args": [
|
|
47
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
48
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
49
|
+
"Hex", "Hex"
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
|
56
|
+
"input": "00112233445566778899aabbccddeeff0001020304050607",
|
|
57
|
+
"expectedOutput": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
|
58
|
+
"recipeConfig": [
|
|
59
|
+
{
|
|
60
|
+
"op": "AES Key Wrap",
|
|
61
|
+
"args": [
|
|
62
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
|
63
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
64
|
+
"Hex", "Hex"
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
|
71
|
+
"input": "00112233445566778899aabbccddeeff0001020304050607",
|
|
72
|
+
"expectedOutput": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
|
73
|
+
"recipeConfig": [
|
|
74
|
+
{
|
|
75
|
+
"op": "AES Key Wrap",
|
|
76
|
+
"args": [
|
|
77
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
78
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
79
|
+
"Hex", "Hex"
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
|
86
|
+
"input": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
|
87
|
+
"expectedOutput": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
|
88
|
+
"recipeConfig": [
|
|
89
|
+
{
|
|
90
|
+
"op": "AES Key Wrap",
|
|
91
|
+
"args": [
|
|
92
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
93
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
94
|
+
"Hex", "Hex"
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
|
|
101
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
|
102
|
+
"expectedOutput": "00112233445566778899aabbccddeeff",
|
|
103
|
+
"recipeConfig": [
|
|
104
|
+
{
|
|
105
|
+
"op": "AES Key Unwrap",
|
|
106
|
+
"args": [
|
|
107
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
108
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
109
|
+
"Hex", "Hex"
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
|
|
116
|
+
"input": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
|
|
117
|
+
"expectedOutput": "00112233445566778899aabbccddeeff",
|
|
118
|
+
"recipeConfig": [
|
|
119
|
+
{
|
|
120
|
+
"op": "AES Key Unwrap",
|
|
121
|
+
"args": [
|
|
122
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
|
123
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
124
|
+
"Hex", "Hex"
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
|
|
131
|
+
"input": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
|
|
132
|
+
"expectedOutput": "00112233445566778899aabbccddeeff",
|
|
133
|
+
"recipeConfig": [
|
|
134
|
+
{
|
|
135
|
+
"op": "AES Key Unwrap",
|
|
136
|
+
"args": [
|
|
137
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
138
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
139
|
+
"Hex", "Hex"
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
|
|
146
|
+
"input": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
|
|
147
|
+
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
|
|
148
|
+
"recipeConfig": [
|
|
149
|
+
{
|
|
150
|
+
"op": "AES Key Unwrap",
|
|
151
|
+
"args": [
|
|
152
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
|
|
153
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
154
|
+
"Hex", "Hex"
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
|
|
161
|
+
"input": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
|
|
162
|
+
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
|
|
163
|
+
"recipeConfig": [
|
|
164
|
+
{
|
|
165
|
+
"op": "AES Key Unwrap",
|
|
166
|
+
"args": [
|
|
167
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
168
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
169
|
+
"Hex", "Hex"
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
|
|
176
|
+
"input": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
|
|
177
|
+
"expectedOutput": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
|
|
178
|
+
"recipeConfig": [
|
|
179
|
+
{
|
|
180
|
+
"op": "AES Key Unwrap",
|
|
181
|
+
"args": [
|
|
182
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
|
|
183
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
184
|
+
"Hex", "Hex"
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "AES Key Wrap: invalid KEK length",
|
|
191
|
+
"input": "00112233445566778899aabbccddeeff",
|
|
192
|
+
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
|
193
|
+
"recipeConfig": [
|
|
194
|
+
{
|
|
195
|
+
"op": "AES Key Wrap",
|
|
196
|
+
"args": [
|
|
197
|
+
{"option": "Hex", "string": "00010203040506070809"},
|
|
198
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
199
|
+
"Hex", "Hex"
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "AES Key Wrap: invalid IV length",
|
|
206
|
+
"input": "00112233445566778899aabbccddeeff",
|
|
207
|
+
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
|
|
208
|
+
"recipeConfig": [
|
|
209
|
+
{
|
|
210
|
+
"op": "AES Key Wrap",
|
|
211
|
+
"args": [
|
|
212
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
213
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6"},
|
|
214
|
+
"Hex", "Hex"
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "AES Key Wrap: input length not multiple of 8",
|
|
221
|
+
"input": "00112233445566778899aabbccddeeff0102",
|
|
222
|
+
"expectedOutput": "input must be 8n (n>=2) bytes (currently 18 bytes)",
|
|
223
|
+
"recipeConfig": [
|
|
224
|
+
{
|
|
225
|
+
"op": "AES Key Wrap",
|
|
226
|
+
"args": [
|
|
227
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
228
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
229
|
+
"Hex", "Hex"
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "AES Key Wrap: input too short",
|
|
236
|
+
"input": "0011223344556677",
|
|
237
|
+
"expectedOutput": "input must be 8n (n>=2) bytes (currently 8 bytes)",
|
|
238
|
+
"recipeConfig": [
|
|
239
|
+
{
|
|
240
|
+
"op": "AES Key Wrap",
|
|
241
|
+
"args": [
|
|
242
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
243
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
244
|
+
"Hex", "Hex"
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "AES Key Unwrap: invalid KEK length",
|
|
251
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
|
252
|
+
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
|
|
253
|
+
"recipeConfig": [
|
|
254
|
+
{
|
|
255
|
+
"op": "AES Key Unwrap",
|
|
256
|
+
"args": [
|
|
257
|
+
{"option": "Hex", "string": "00010203040506070809"},
|
|
258
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
259
|
+
"Hex", "Hex"
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "AES Key Unwrap: invalid IV length",
|
|
266
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
|
|
267
|
+
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
|
|
268
|
+
"recipeConfig": [
|
|
269
|
+
{
|
|
270
|
+
"op": "AES Key Unwrap",
|
|
271
|
+
"args": [
|
|
272
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
273
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6"},
|
|
274
|
+
"Hex", "Hex"
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "AES Key Unwrap: input length not multiple of 8",
|
|
281
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5e621",
|
|
282
|
+
"expectedOutput": "input must be 8n (n>=3) bytes (currently 26 bytes)",
|
|
283
|
+
"recipeConfig": [
|
|
284
|
+
{
|
|
285
|
+
"op": "AES Key Unwrap",
|
|
286
|
+
"args": [
|
|
287
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
288
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
289
|
+
"Hex", "Hex"
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "AES Key Unwrap: input too short",
|
|
296
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b82",
|
|
297
|
+
"expectedOutput": "input must be 8n (n>=3) bytes (currently 16 bytes)",
|
|
298
|
+
"recipeConfig": [
|
|
299
|
+
{
|
|
300
|
+
"op": "AES Key Unwrap",
|
|
301
|
+
"args": [
|
|
302
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
303
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
304
|
+
"Hex", "Hex"
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "AES Key Unwrap: corrupted input",
|
|
311
|
+
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe6",
|
|
312
|
+
"expectedOutput": "IV mismatch",
|
|
313
|
+
"recipeConfig": [
|
|
314
|
+
{
|
|
315
|
+
"op": "AES Key Unwrap",
|
|
316
|
+
"args": [
|
|
317
|
+
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
|
|
318
|
+
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
|
|
319
|
+
"Hex", "Hex"
|
|
320
|
+
],
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
]);
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author mikecat
|
|
3
|
+
* @copyright Crown Copyright 2022
|
|
4
|
+
* @license Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
8
|
+
|
|
9
|
+
TestRegister.addTests([
|
|
10
|
+
{
|
|
11
|
+
name: "Rabbit: RFC Test vector, without IV 1",
|
|
12
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
13
|
+
expectedOutput: "b15754f036a5d6ecf56b45261c4af70288e8d815c59c0c397b696c4789c68aa7f416a1c3700cd451da68d1881673d696",
|
|
14
|
+
recipeConfig: [
|
|
15
|
+
{
|
|
16
|
+
"op": "Rabbit",
|
|
17
|
+
"args": [
|
|
18
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
19
|
+
{"option": "Hex", "string": ""},
|
|
20
|
+
"Big", "Hex", "Hex"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "Rabbit: RFC Test vector, without IV 2",
|
|
27
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
28
|
+
expectedOutput: "3d2df3c83ef627a1e97fc38487e2519cf576cd61f4405b8896bf53aa8554fc19e5547473fbdb43508ae53b20204d4c5e",
|
|
29
|
+
recipeConfig: [
|
|
30
|
+
{
|
|
31
|
+
"op": "Rabbit",
|
|
32
|
+
"args": [
|
|
33
|
+
{"option": "Hex", "string": "912813292e3d36fe3bfc62f1dc51c3ac"},
|
|
34
|
+
{"option": "Hex", "string": ""},
|
|
35
|
+
"Big", "Hex", "Hex"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Rabbit: RFC Test vector, without IV 3",
|
|
42
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
43
|
+
expectedOutput: "0cb10dcda041cdac32eb5cfd02d0609b95fc9fca0f17015a7b7092114cff3ead9649e5de8bfc7f3f924147ad3a947428",
|
|
44
|
+
recipeConfig: [
|
|
45
|
+
{
|
|
46
|
+
"op": "Rabbit",
|
|
47
|
+
"args": [
|
|
48
|
+
{"option": "Hex", "string": "8395741587e0c733e9e9ab01c09b0043"},
|
|
49
|
+
{"option": "Hex", "string": ""},
|
|
50
|
+
"Big", "Hex", "Hex"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "Rabbit: RFC Test vector, with IV 1",
|
|
57
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
58
|
+
expectedOutput: "c6a7275ef85495d87ccd5d376705b7ed5f29a6ac04f5efd47b8f293270dc4a8d2ade822b29de6c1ee52bdb8a47bf8f66",
|
|
59
|
+
recipeConfig: [
|
|
60
|
+
{
|
|
61
|
+
"op": "Rabbit",
|
|
62
|
+
"args": [
|
|
63
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
64
|
+
{"option": "Hex", "string": "0000000000000000"},
|
|
65
|
+
"Big", "Hex", "Hex"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "Rabbit: RFC Test vector, with IV 2",
|
|
72
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
73
|
+
expectedOutput: "1fcd4eb9580012e2e0dccc9222017d6da75f4e10d12125017b2499ffed936f2eebc112c393e738392356bdd012029ba7",
|
|
74
|
+
recipeConfig: [
|
|
75
|
+
{
|
|
76
|
+
"op": "Rabbit",
|
|
77
|
+
"args": [
|
|
78
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
79
|
+
{"option": "Hex", "string": "c373f575c1267e59"},
|
|
80
|
+
"Big", "Hex", "Hex"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "Rabbit: RFC Test vector, with IV 3",
|
|
87
|
+
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
88
|
+
expectedOutput: "445ad8c805858dbf70b6af23a151104d96c8f27947f42c5baeae67c6acc35b039fcbfc895fa71c17313df034f01551cb",
|
|
89
|
+
recipeConfig: [
|
|
90
|
+
{
|
|
91
|
+
"op": "Rabbit",
|
|
92
|
+
"args": [
|
|
93
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
94
|
+
{"option": "Hex", "string": "a6eb561ad2f41727"},
|
|
95
|
+
"Big", "Hex", "Hex"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "Rabbit: generated stream should be XORed with the input",
|
|
102
|
+
input: "cedda96c054e3ddd93da7ed05e2a4b7bdb0c00fe214f03502e2708b2c2bfc77aa2311b0b9af8aa78d119f92b26db0a6b",
|
|
103
|
+
expectedOutput: "7f8afd9c33ebeb3166b13bf64260bc7953e4d8ebe4d30f69554e64f54b794ddd5627bac8eaf47e290b7128a330a8dcfd",
|
|
104
|
+
recipeConfig: [
|
|
105
|
+
{
|
|
106
|
+
"op": "Rabbit",
|
|
107
|
+
"args": [
|
|
108
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
109
|
+
{"option": "Hex", "string": ""},
|
|
110
|
+
"Big", "Hex", "Hex"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "Rabbit: least significant bits should be used for the last block",
|
|
117
|
+
input: "0000000000000000",
|
|
118
|
+
expectedOutput: "f56b45261c4af702",
|
|
119
|
+
recipeConfig: [
|
|
120
|
+
{
|
|
121
|
+
"op": "Rabbit",
|
|
122
|
+
"args": [
|
|
123
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
124
|
+
{"option": "Hex", "string": ""},
|
|
125
|
+
"Big", "Hex", "Hex"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "Rabbit: invalid key length",
|
|
132
|
+
input: "",
|
|
133
|
+
expectedOutput: "Invalid key length: 8 bytes (expected: 16)",
|
|
134
|
+
recipeConfig: [
|
|
135
|
+
{
|
|
136
|
+
"op": "Rabbit",
|
|
137
|
+
"args": [
|
|
138
|
+
{"option": "Hex", "string": "0000000000000000"},
|
|
139
|
+
{"option": "Hex", "string": ""},
|
|
140
|
+
"Big", "Hex", "Hex"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "Rabbit: invalid IV length",
|
|
147
|
+
input: "",
|
|
148
|
+
expectedOutput: "Invalid IV length: 4 bytes (expected: 0 or 8)",
|
|
149
|
+
recipeConfig: [
|
|
150
|
+
{
|
|
151
|
+
"op": "Rabbit",
|
|
152
|
+
"args": [
|
|
153
|
+
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
|
154
|
+
{"option": "Hex", "string": "00000000"},
|
|
155
|
+
"Big", "Hex", "Hex"
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
// this testcase is taken from the first example on Crypto++ Wiki
|
|
162
|
+
// https://www.cryptopp.com/wiki/Rabbit
|
|
163
|
+
name: "Rabbit: little-endian mode (Crypto++ compatible)",
|
|
164
|
+
input: "Rabbit stream cipher test",
|
|
165
|
+
expectedOutput: "1ae2d4edcf9b6063b00fd6fda0b223aded157e77031cf0440b",
|
|
166
|
+
recipeConfig: [
|
|
167
|
+
{
|
|
168
|
+
"op": "Rabbit",
|
|
169
|
+
"args": [
|
|
170
|
+
{"option": "Hex", "string": "23c2731e8b5469fd8dabb5bc592a0f3a"},
|
|
171
|
+
{"option": "Hex", "string": "712906405ef03201"},
|
|
172
|
+
"Little", "Raw", "Hex"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
]);
|