cyberchef 10.22.1 → 10.23.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 +131 -0
- package/CONTRIBUTING.md +37 -0
- package/Dockerfile +2 -0
- package/Gruntfile.js +0 -12
- package/README.md +1 -1
- package/babel.config.js +0 -6
- package/package.json +63 -62
- package/src/core/Chef.mjs +8 -1
- package/src/core/Ingredient.mjs +5 -2
- package/src/core/Operation.mjs +6 -1
- package/src/core/Recipe.mjs +10 -5
- package/src/core/config/Categories.json +18 -3
- package/src/core/config/OperationConfig.json +496 -23
- package/src/core/config/modules/Ciphers.mjs +6 -0
- package/src/core/config/modules/Crypto.mjs +6 -0
- package/src/core/config/modules/Default.mjs +6 -0
- package/src/core/config/modules/Shellcode.mjs +2 -0
- package/src/core/lib/AudioBytes.mjs +103 -0
- package/src/core/lib/AudioMetaSchema.mjs +82 -0
- package/src/core/lib/AudioParsers.mjs +630 -0
- package/src/core/lib/BigIntUtils.mjs +73 -0
- package/src/core/lib/Modhex.mjs +2 -0
- package/src/core/lib/QRCode.mjs +30 -10
- package/src/core/lib/RC6.mjs +625 -0
- package/src/core/operations/A1Z26CipherDecode.mjs +1 -1
- package/src/core/operations/AddTextToImage.mjs +116 -64
- package/src/core/operations/BlurImage.mjs +10 -12
- package/src/core/operations/ContainImage.mjs +50 -40
- package/src/core/operations/ConvertImageFormat.mjs +33 -39
- package/src/core/operations/CoverImage.mjs +39 -37
- package/src/core/operations/CropImage.mjs +35 -21
- package/src/core/operations/DisassembleARM.mjs +193 -0
- package/src/core/operations/DitherImage.mjs +8 -8
- package/src/core/operations/EscapeUnicodeCharacters.mjs +0 -17
- package/src/core/operations/ExtractAudioMetadata.mjs +175 -0
- package/src/core/operations/ExtractLSB.mjs +17 -11
- package/src/core/operations/ExtractRGBA.mjs +12 -10
- package/src/core/operations/FlaskSessionDecode.mjs +80 -0
- package/src/core/operations/FlaskSessionSign.mjs +89 -0
- package/src/core/operations/FlaskSessionVerify.mjs +136 -0
- package/src/core/operations/FlipImage.mjs +14 -10
- package/src/core/operations/GenerateImage.mjs +39 -32
- package/src/core/operations/ImageBrightnessContrast.mjs +10 -10
- package/src/core/operations/ImageFilter.mjs +14 -13
- package/src/core/operations/ImageHueSaturationLightness.mjs +22 -20
- package/src/core/operations/ImageOpacity.mjs +6 -8
- package/src/core/operations/InvertImage.mjs +4 -6
- package/src/core/operations/Jq.mjs +12 -4
- package/src/core/operations/NormaliseImage.mjs +5 -7
- package/src/core/operations/OffsetChecker.mjs +1 -1
- package/src/core/operations/ParseEthernetFrame.mjs +112 -0
- package/src/core/operations/ParseIPv4Header.mjs +23 -6
- package/src/core/operations/ParseQRCode.mjs +13 -13
- package/src/core/operations/PseudoRandomIntegerGenerator.mjs +164 -0
- package/src/core/operations/RC6Decrypt.mjs +119 -0
- package/src/core/operations/RC6Encrypt.mjs +119 -0
- package/src/core/operations/RandomizeColourPalette.mjs +11 -11
- package/src/core/operations/ResizeImage.mjs +30 -23
- package/src/core/operations/RotateImage.mjs +8 -9
- package/src/core/operations/SQLBeautify.mjs +21 -3
- package/src/core/operations/SharpenImage.mjs +94 -62
- package/src/core/operations/SplitColourChannels.mjs +47 -21
- package/src/core/operations/TextIntegerConverter.mjs +123 -0
- package/src/core/operations/UnescapeUnicodeCharacters.mjs +17 -0
- package/src/core/operations/ViewBitPlane.mjs +16 -20
- package/src/core/operations/index.mjs +20 -0
- package/src/node/index.mjs +50 -0
- package/src/web/HTMLIngredient.mjs +24 -43
- package/src/web/Manager.mjs +1 -0
- package/src/web/html/index.html +6 -6
- package/src/web/static/fonts/bmfonts/Roboto72White.fnt +491 -485
- package/src/web/static/fonts/bmfonts/RobotoBlack72White.fnt +494 -488
- package/src/web/static/fonts/bmfonts/RobotoMono72White.fnt +110 -103
- package/src/web/static/fonts/bmfonts/RobotoSlab72White.fnt +498 -492
- package/src/web/stylesheets/layout/_banner.css +30 -0
- package/src/web/stylesheets/layout/_modals.css +5 -0
- package/src/web/stylesheets/utils/_overrides.css +7 -0
- package/src/web/waiters/ControlsWaiter.mjs +82 -0
- package/src/web/waiters/InputWaiter.mjs +12 -6
- package/src/web/waiters/RecipeWaiter.mjs +2 -2
- package/tests/browser/02_ops.js +23 -3
- package/tests/node/index.mjs +1 -0
- package/tests/node/tests/lib/BigIntUtils.mjs +150 -0
- package/tests/node/tests/operations.mjs +9 -7
- package/tests/operations/index.mjs +8 -0
- package/tests/operations/tests/A1Z26CipherDecode.mjs +33 -0
- package/tests/operations/tests/DisassembleARM.mjs +377 -0
- package/tests/operations/tests/ExtractAudioMetadata.mjs +287 -0
- package/tests/operations/tests/FlaskSession.mjs +246 -0
- package/tests/operations/tests/GenerateQRCode.mjs +67 -0
- package/tests/operations/tests/JWTSign.mjs +83 -8
- package/tests/operations/tests/Jq.mjs +32 -0
- package/tests/operations/tests/Modhex.mjs +20 -0
- package/tests/operations/tests/ParseEthernetFrame.mjs +45 -0
- package/tests/operations/tests/RC6.mjs +487 -0
- package/tests/operations/tests/SQLBeautify.mjs +54 -0
- package/tests/operations/tests/TextIntegerConverter.mjs +199 -0
- package/tests/samples/Audio.mjs +73 -0
- package/tests/samples/Images.mjs +0 -12
- package/webpack.config.js +10 -7
- package/src/core/lib/ImageManipulation.mjs +0 -251
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RC6 cipher tests.
|
|
3
|
+
*
|
|
4
|
+
* Test vectors from the IETF draft:
|
|
5
|
+
* "Test Vectors for RC6 and RC5"
|
|
6
|
+
* https://datatracker.ietf.org/doc/html/draft-krovetz-rc6-rc5-vectors-00
|
|
7
|
+
*
|
|
8
|
+
* @author Medjedtxm
|
|
9
|
+
* @copyright Crown Copyright 2026
|
|
10
|
+
* @license Apache-2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
14
|
+
|
|
15
|
+
TestRegister.addTests([
|
|
16
|
+
// ============================================================
|
|
17
|
+
// IETF TEST VECTORS - RC6-8/12/4
|
|
18
|
+
// ============================================================
|
|
19
|
+
{
|
|
20
|
+
name: "RC6-8/12/4: IETF vector encrypt",
|
|
21
|
+
input: "00010203",
|
|
22
|
+
expectedOutput: "aefc4612",
|
|
23
|
+
recipeConfig: [
|
|
24
|
+
{
|
|
25
|
+
op: "RC6 Encrypt",
|
|
26
|
+
args: [
|
|
27
|
+
{ string: "00010203", option: "Hex" },
|
|
28
|
+
{ string: "", option: "Hex" },
|
|
29
|
+
"ECB", "Hex", "Hex", "NO", 8, 12
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "RC6-8/12/4: IETF vector decrypt",
|
|
36
|
+
input: "aefc4612",
|
|
37
|
+
expectedOutput: "00010203",
|
|
38
|
+
recipeConfig: [
|
|
39
|
+
{
|
|
40
|
+
op: "RC6 Decrypt",
|
|
41
|
+
args: [
|
|
42
|
+
{ string: "00010203", option: "Hex" },
|
|
43
|
+
{ string: "", option: "Hex" },
|
|
44
|
+
"ECB", "Hex", "Hex", "NO", 8, 12
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// ============================================================
|
|
51
|
+
// IETF TEST VECTORS - RC6-16/16/8
|
|
52
|
+
// ============================================================
|
|
53
|
+
{
|
|
54
|
+
name: "RC6-16/16/8: IETF vector encrypt",
|
|
55
|
+
input: "0001020304050607",
|
|
56
|
+
expectedOutput: "2ff0b68eaeffad5b",
|
|
57
|
+
recipeConfig: [
|
|
58
|
+
{
|
|
59
|
+
op: "RC6 Encrypt",
|
|
60
|
+
args: [
|
|
61
|
+
{ string: "0001020304050607", option: "Hex" },
|
|
62
|
+
{ string: "", option: "Hex" },
|
|
63
|
+
"ECB", "Hex", "Hex", "NO", 16, 16
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "RC6-16/16/8: IETF vector decrypt",
|
|
70
|
+
input: "2ff0b68eaeffad5b",
|
|
71
|
+
expectedOutput: "0001020304050607",
|
|
72
|
+
recipeConfig: [
|
|
73
|
+
{
|
|
74
|
+
op: "RC6 Decrypt",
|
|
75
|
+
args: [
|
|
76
|
+
{ string: "0001020304050607", option: "Hex" },
|
|
77
|
+
{ string: "", option: "Hex" },
|
|
78
|
+
"ECB", "Hex", "Hex", "NO", 16, 16
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// ============================================================
|
|
85
|
+
// IETF TEST VECTORS - RC6-32/20/16 (AES standard)
|
|
86
|
+
// ============================================================
|
|
87
|
+
{
|
|
88
|
+
name: "RC6-32/20/16: IETF vector encrypt (AES standard)",
|
|
89
|
+
input: "000102030405060708090a0b0c0d0e0f",
|
|
90
|
+
expectedOutput: "3a96f9c7f6755cfe46f00e3dcd5d2a3c",
|
|
91
|
+
recipeConfig: [
|
|
92
|
+
{
|
|
93
|
+
op: "RC6 Encrypt",
|
|
94
|
+
args: [
|
|
95
|
+
{ string: "000102030405060708090a0b0c0d0e0f", option: "Hex" },
|
|
96
|
+
{ string: "", option: "Hex" },
|
|
97
|
+
"ECB", "Hex", "Hex", "NO", 32, 20
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "RC6-32/20/16: IETF vector decrypt (AES standard)",
|
|
104
|
+
input: "3a96f9c7f6755cfe46f00e3dcd5d2a3c",
|
|
105
|
+
expectedOutput: "000102030405060708090a0b0c0d0e0f",
|
|
106
|
+
recipeConfig: [
|
|
107
|
+
{
|
|
108
|
+
op: "RC6 Decrypt",
|
|
109
|
+
args: [
|
|
110
|
+
{ string: "000102030405060708090a0b0c0d0e0f", option: "Hex" },
|
|
111
|
+
{ string: "", option: "Hex" },
|
|
112
|
+
"ECB", "Hex", "Hex", "NO", 32, 20
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// ============================================================
|
|
119
|
+
// IETF TEST VECTORS - RC6-64/24/24
|
|
120
|
+
// ============================================================
|
|
121
|
+
{
|
|
122
|
+
name: "RC6-64/24/24: IETF vector encrypt",
|
|
123
|
+
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
|
124
|
+
expectedOutput: "c002de050bd55e5d36864ab9853338e6dc4a1326c6bdaaeb1bc9e4fd67886617",
|
|
125
|
+
recipeConfig: [
|
|
126
|
+
{
|
|
127
|
+
op: "RC6 Encrypt",
|
|
128
|
+
args: [
|
|
129
|
+
{ string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" },
|
|
130
|
+
{ string: "", option: "Hex" },
|
|
131
|
+
"ECB", "Hex", "Hex", "NO", 64, 24
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "RC6-64/24/24: IETF vector decrypt",
|
|
138
|
+
input: "c002de050bd55e5d36864ab9853338e6dc4a1326c6bdaaeb1bc9e4fd67886617",
|
|
139
|
+
expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
|
140
|
+
recipeConfig: [
|
|
141
|
+
{
|
|
142
|
+
op: "RC6 Decrypt",
|
|
143
|
+
args: [
|
|
144
|
+
{ string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" },
|
|
145
|
+
{ string: "", option: "Hex" },
|
|
146
|
+
"ECB", "Hex", "Hex", "NO", 64, 24
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
// ============================================================
|
|
153
|
+
// IETF TEST VECTORS - RC6-128/28/32
|
|
154
|
+
// ============================================================
|
|
155
|
+
{
|
|
156
|
+
name: "RC6-128/28/32: IETF vector encrypt",
|
|
157
|
+
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
|
|
158
|
+
expectedOutput: "4ed87c64baffecd4303ee6a79aafaef575b351c024272be70a70b4a392cfc157dba52d529a79e83845bf43d67545383aed3dbf4f0d23640e44cbf6cdaa034dcb",
|
|
159
|
+
recipeConfig: [
|
|
160
|
+
{
|
|
161
|
+
op: "RC6 Encrypt",
|
|
162
|
+
args: [
|
|
163
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
164
|
+
{ string: "", option: "Hex" },
|
|
165
|
+
"ECB", "Hex", "Hex", "NO", 128, 28
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "RC6-128/28/32: IETF vector decrypt",
|
|
172
|
+
input: "4ed87c64baffecd4303ee6a79aafaef575b351c024272be70a70b4a392cfc157dba52d529a79e83845bf43d67545383aed3dbf4f0d23640e44cbf6cdaa034dcb",
|
|
173
|
+
expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
|
|
174
|
+
recipeConfig: [
|
|
175
|
+
{
|
|
176
|
+
op: "RC6 Decrypt",
|
|
177
|
+
args: [
|
|
178
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
179
|
+
{ string: "", option: "Hex" },
|
|
180
|
+
"ECB", "Hex", "Hex", "NO", 128, 28
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
// ============================================================
|
|
187
|
+
// IETF TEST VECTORS - RC6-24/4/0 (non-power-of-2)
|
|
188
|
+
// ============================================================
|
|
189
|
+
{
|
|
190
|
+
name: "RC6-24/4/0: IETF non-standard vector encrypt (w=24, empty key)",
|
|
191
|
+
input: "000102030405060708090a0b",
|
|
192
|
+
expectedOutput: "0177982579be2ee3303269b9",
|
|
193
|
+
recipeConfig: [
|
|
194
|
+
{
|
|
195
|
+
op: "RC6 Encrypt",
|
|
196
|
+
args: [
|
|
197
|
+
{ string: "", option: "Hex" },
|
|
198
|
+
{ string: "", option: "Hex" },
|
|
199
|
+
"ECB", "Hex", "Hex", "NO", 24, 4
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "RC6-24/4/0: IETF non-standard vector decrypt (w=24, empty key)",
|
|
206
|
+
input: "0177982579be2ee3303269b9",
|
|
207
|
+
expectedOutput: "000102030405060708090a0b",
|
|
208
|
+
recipeConfig: [
|
|
209
|
+
{
|
|
210
|
+
op: "RC6 Decrypt",
|
|
211
|
+
args: [
|
|
212
|
+
{ string: "", option: "Hex" },
|
|
213
|
+
{ string: "", option: "Hex" },
|
|
214
|
+
"ECB", "Hex", "Hex", "NO", 24, 4
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
// ============================================================
|
|
221
|
+
// IETF TEST VECTORS - RC6-80/4/12 (non-power-of-2)
|
|
222
|
+
// ============================================================
|
|
223
|
+
{
|
|
224
|
+
name: "RC6-80/4/12: IETF non-standard vector encrypt (w=80)",
|
|
225
|
+
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627",
|
|
226
|
+
expectedOutput: "26d9d6128601d06dec3817d401f1c0ff715473543875da417c2116d1e87c919a49311b00b4e17962",
|
|
227
|
+
recipeConfig: [
|
|
228
|
+
{
|
|
229
|
+
op: "RC6 Encrypt",
|
|
230
|
+
args: [
|
|
231
|
+
{ string: "000102030405060708090a0b", option: "Hex" },
|
|
232
|
+
{ string: "", option: "Hex" },
|
|
233
|
+
"ECB", "Hex", "Hex", "NO", 80, 4
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "RC6-80/4/12: IETF non-standard vector decrypt (w=80)",
|
|
240
|
+
input: "26d9d6128601d06dec3817d401f1c0ff715473543875da417c2116d1e87c919a49311b00b4e17962",
|
|
241
|
+
expectedOutput: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627",
|
|
242
|
+
recipeConfig: [
|
|
243
|
+
{
|
|
244
|
+
op: "RC6 Decrypt",
|
|
245
|
+
args: [
|
|
246
|
+
{ string: "000102030405060708090a0b", option: "Hex" },
|
|
247
|
+
{ string: "", option: "Hex" },
|
|
248
|
+
"ECB", "Hex", "Hex", "NO", 80, 4
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
// ============================================================
|
|
255
|
+
// ADDITIONAL KEY SIZE TESTS - RC6-32 (192-bit and 256-bit keys)
|
|
256
|
+
// ============================================================
|
|
257
|
+
{
|
|
258
|
+
name: "RC6-32/20/24: 192-bit key encrypt",
|
|
259
|
+
input: "000102030405060708090a0b0c0d0e0f",
|
|
260
|
+
expectedOutput: "a68a14ff1342262a2bbd21f7966615eb",
|
|
261
|
+
recipeConfig: [
|
|
262
|
+
{
|
|
263
|
+
op: "RC6 Encrypt",
|
|
264
|
+
args: [
|
|
265
|
+
{ string: "000102030405060708090a0b0c0d0e0f1011121314151617", option: "Hex" },
|
|
266
|
+
{ string: "", option: "Hex" },
|
|
267
|
+
"ECB", "Hex", "Hex", "NO", 32, 20
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "RC6-32/20/32: 256-bit key encrypt",
|
|
274
|
+
input: "000102030405060708090a0b0c0d0e0f",
|
|
275
|
+
expectedOutput: "921c3ecd43d9426a90089334d67aea2e",
|
|
276
|
+
recipeConfig: [
|
|
277
|
+
{
|
|
278
|
+
op: "RC6 Encrypt",
|
|
279
|
+
args: [
|
|
280
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
281
|
+
{ string: "", option: "Hex" },
|
|
282
|
+
"ECB", "Hex", "Hex", "NO", 32, 20
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
// ============================================================
|
|
289
|
+
// ROUND-TRIP TESTS - One per word size to verify encrypt/decrypt
|
|
290
|
+
// ============================================================
|
|
291
|
+
{
|
|
292
|
+
name: "RC6-8 Round-trip: CBC mode",
|
|
293
|
+
input: "Hello World!",
|
|
294
|
+
expectedOutput: "Hello World!",
|
|
295
|
+
recipeConfig: [
|
|
296
|
+
{
|
|
297
|
+
op: "RC6 Encrypt",
|
|
298
|
+
args: [
|
|
299
|
+
{ string: "mysecret", option: "UTF8" },
|
|
300
|
+
{ string: "abcd", option: "UTF8" },
|
|
301
|
+
"CBC", "Raw", "Hex", "PKCS5", 8, 12
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
op: "RC6 Decrypt",
|
|
306
|
+
args: [
|
|
307
|
+
{ string: "mysecret", option: "UTF8" },
|
|
308
|
+
{ string: "abcd", option: "UTF8" },
|
|
309
|
+
"CBC", "Hex", "Raw", "PKCS5", 8, 12
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "RC6-16 Round-trip: CBC mode",
|
|
316
|
+
input: "The quick brown fox",
|
|
317
|
+
expectedOutput: "The quick brown fox",
|
|
318
|
+
recipeConfig: [
|
|
319
|
+
{
|
|
320
|
+
op: "RC6 Encrypt",
|
|
321
|
+
args: [
|
|
322
|
+
{ string: "secretkey1234567", option: "UTF8" },
|
|
323
|
+
{ string: "initvec!", option: "UTF8" },
|
|
324
|
+
"CBC", "Raw", "Hex", "PKCS5", 16, 16
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
op: "RC6 Decrypt",
|
|
329
|
+
args: [
|
|
330
|
+
{ string: "secretkey1234567", option: "UTF8" },
|
|
331
|
+
{ string: "initvec!", option: "UTF8" },
|
|
332
|
+
"CBC", "Hex", "Raw", "PKCS5", 16, 16
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: "RC6-32 Round-trip: CBC mode",
|
|
339
|
+
input: "The quick brown fox jumps over the lazy dog",
|
|
340
|
+
expectedOutput: "The quick brown fox jumps over the lazy dog",
|
|
341
|
+
recipeConfig: [
|
|
342
|
+
{
|
|
343
|
+
op: "RC6 Encrypt",
|
|
344
|
+
args: [
|
|
345
|
+
{ string: "aabbccddeeff00112233445566778899", option: "Hex" },
|
|
346
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
347
|
+
"CBC", "Raw", "Hex", "PKCS5", 32, 20
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
op: "RC6 Decrypt",
|
|
352
|
+
args: [
|
|
353
|
+
{ string: "aabbccddeeff00112233445566778899", option: "Hex" },
|
|
354
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
355
|
+
"CBC", "Hex", "Raw", "PKCS5", 32, 20
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
name: "RC6-64 Round-trip: CBC mode",
|
|
362
|
+
input: "RC6 with 64-bit words is powerful!",
|
|
363
|
+
expectedOutput: "RC6 with 64-bit words is powerful!",
|
|
364
|
+
recipeConfig: [
|
|
365
|
+
{
|
|
366
|
+
op: "RC6 Encrypt",
|
|
367
|
+
args: [
|
|
368
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
369
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
370
|
+
"CBC", "Raw", "Hex", "PKCS5", 64, 24
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
op: "RC6 Decrypt",
|
|
375
|
+
args: [
|
|
376
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
377
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
378
|
+
"CBC", "Hex", "Raw", "PKCS5", 64, 24
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: "RC6-128 Round-trip: ECB mode",
|
|
385
|
+
input: "RC6 with 128-bit words provides massive block size for testing purposes!",
|
|
386
|
+
expectedOutput: "RC6 with 128-bit words provides massive block size for testing purposes!",
|
|
387
|
+
recipeConfig: [
|
|
388
|
+
{
|
|
389
|
+
op: "RC6 Encrypt",
|
|
390
|
+
args: [
|
|
391
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
392
|
+
{ string: "", option: "Hex" },
|
|
393
|
+
"ECB", "Raw", "Hex", "PKCS5", 128, 28
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
op: "RC6 Decrypt",
|
|
398
|
+
args: [
|
|
399
|
+
{ string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", option: "Hex" },
|
|
400
|
+
{ string: "", option: "Hex" },
|
|
401
|
+
"ECB", "Hex", "Raw", "PKCS5", 128, 28
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
// ============================================================
|
|
408
|
+
// STREAM MODES TEST - Verify CFB/OFB/CTR work correctly
|
|
409
|
+
// ============================================================
|
|
410
|
+
{
|
|
411
|
+
name: "RC6-32 Round-trip: CTR mode",
|
|
412
|
+
input: "CTR mode test message",
|
|
413
|
+
expectedOutput: "CTR mode test message",
|
|
414
|
+
recipeConfig: [
|
|
415
|
+
{
|
|
416
|
+
op: "RC6 Encrypt",
|
|
417
|
+
args: [
|
|
418
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
419
|
+
{ string: "00000000000000000000000000000001", option: "Hex" },
|
|
420
|
+
"CTR", "Raw", "Hex", "PKCS5", 32, 20
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
op: "RC6 Decrypt",
|
|
425
|
+
args: [
|
|
426
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
427
|
+
{ string: "00000000000000000000000000000001", option: "Hex" },
|
|
428
|
+
"CTR", "Hex", "Raw", "PKCS5", 32, 20
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
// ============================================================
|
|
435
|
+
// CUSTOM ROUNDS TEST - Verify non-standard round count works
|
|
436
|
+
// ============================================================
|
|
437
|
+
{
|
|
438
|
+
name: "RC6-32 Round-trip: Custom 8 rounds",
|
|
439
|
+
input: "Testing custom rounds",
|
|
440
|
+
expectedOutput: "Testing custom rounds",
|
|
441
|
+
recipeConfig: [
|
|
442
|
+
{
|
|
443
|
+
op: "RC6 Encrypt",
|
|
444
|
+
args: [
|
|
445
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
446
|
+
{ string: "", option: "Hex" },
|
|
447
|
+
"ECB", "Raw", "Hex", "PKCS5", 32, 8
|
|
448
|
+
]
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
op: "RC6 Decrypt",
|
|
452
|
+
args: [
|
|
453
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
454
|
+
{ string: "", option: "Hex" },
|
|
455
|
+
"ECB", "Hex", "Raw", "PKCS5", 32, 8
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
// ============================================================
|
|
462
|
+
// EDGE CASE TEST - Padding boundary
|
|
463
|
+
// ============================================================
|
|
464
|
+
{
|
|
465
|
+
name: "RC6-32 Round-trip: Exact block size input",
|
|
466
|
+
input: "1234567890123456",
|
|
467
|
+
expectedOutput: "1234567890123456",
|
|
468
|
+
recipeConfig: [
|
|
469
|
+
{
|
|
470
|
+
op: "RC6 Encrypt",
|
|
471
|
+
args: [
|
|
472
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
473
|
+
{ string: "", option: "Hex" },
|
|
474
|
+
"ECB", "Raw", "Hex", "PKCS5", 32, 20
|
|
475
|
+
]
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
op: "RC6 Decrypt",
|
|
479
|
+
args: [
|
|
480
|
+
{ string: "00112233445566778899aabbccddeeff", option: "Hex" },
|
|
481
|
+
{ string: "", option: "Hex" },
|
|
482
|
+
"ECB", "Hex", "Raw", "PKCS5", 32, 20
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
]);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLBeautify tests.
|
|
3
|
+
*
|
|
4
|
+
* @author GCHQDeveloper581
|
|
5
|
+
* @copyright Crown Copyright 2026
|
|
6
|
+
* @license Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
import TestRegister from "../../lib/TestRegister.mjs";
|
|
9
|
+
|
|
10
|
+
TestRegister.addTests([
|
|
11
|
+
{
|
|
12
|
+
name: "SQL Beautify - basic",
|
|
13
|
+
input: "SELECT MONTH, ID, RAIN_I, TEMP_F FROM STATS;",
|
|
14
|
+
expectedOutput:
|
|
15
|
+
`SELECT
|
|
16
|
+
MONTH,
|
|
17
|
+
ID,
|
|
18
|
+
RAIN_I,
|
|
19
|
+
TEMP_F
|
|
20
|
+
FROM
|
|
21
|
+
STATS;`,
|
|
22
|
+
recipeConfig: [
|
|
23
|
+
{
|
|
24
|
+
op: "SQL Beautify",
|
|
25
|
+
args: [" "],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "SQL Beautify - upsert",
|
|
31
|
+
input: "INSERT INTO Table1 SELECT * FROM (SELECT :Bind1 as Field1, :Bind2 as Field2, :id as id) as new_data ON DUPLICATE KEY UPDATE Field1 = new_data.Field1, Field2 = new_data.Field2;",
|
|
32
|
+
expectedOutput:
|
|
33
|
+
`INSERT INTO
|
|
34
|
+
Table1
|
|
35
|
+
SELECT
|
|
36
|
+
*
|
|
37
|
+
FROM
|
|
38
|
+
(
|
|
39
|
+
SELECT
|
|
40
|
+
:Bind1 as Field1,
|
|
41
|
+
:Bind2 as Field2,
|
|
42
|
+
:id as id
|
|
43
|
+
) as new_data
|
|
44
|
+
ON DUPLICATE KEY UPDATE
|
|
45
|
+
Field1 = new_data.Field1,
|
|
46
|
+
Field2 = new_data.Field2;`,
|
|
47
|
+
recipeConfig: [
|
|
48
|
+
{
|
|
49
|
+
op: "SQL Beautify",
|
|
50
|
+
args: [" "],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
]);
|