Skip to content

Commit 18e5b9f

Browse files
authored
Merge branch 'master' into kgoto/add-handlebar
2 parents 361a3b2 + 411f78d commit 18e5b9f

35 files changed

+2613
-115
lines changed

.github/workflows/releases.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,5 @@ jobs:
9292

9393
- name: Publish to NPM
9494
uses: JS-DevTools/npm-publish@v1
95-
if: false
9695
with:
97-
token: ${{ secrets.NPM_TOKEN }}
96+
token: ${{ secrets.NPM_TOKEN }}

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ RUN npm run build
2929
#########################################
3030
# We are using Github Actions: redhat-actions/buildah-build@v2 which needs manual selection of arch in base image
3131
# Remove TARGETARCH if docker buildx is supported in the CI release as --platform=$TARGETPLATFORM will be automatically set
32-
ARG TARGETARCH
3332
ARG TARGETPLATFORM
34-
FROM ${TARGETARCH}/nginx:stable-alpine AS cyberchef
33+
FROM --platform=${TARGETPLATFORM} nginx:stable-alpine AS cyberchef
3534

3635
COPY --from=builder /app/build/prod /usr/share/nginx/html/

package-lock.json

Lines changed: 42 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
"flat": "^6.0.1",
134134
"geodesy": "1.1.3",
135135
"handlebars": "^4.7.8",
136+
"hash-wasm": "^4.12.0",
136137
"highlight.js": "^11.9.0",
137138
"ieee754": "^1.2.1",
138139
"jimp": "^0.22.12",
@@ -141,6 +142,7 @@
141142
"js-sha3": "^0.9.3",
142143
"jsesc": "^3.0.2",
143144
"json5": "^2.2.3",
145+
"jsonata": "^2.0.3",
144146
"jsonpath-plus": "^9.0.0",
145147
"jsonwebtoken": "8.5.1",
146148
"jsqr": "^1.4.0",
@@ -181,6 +183,7 @@
181183
"ua-parser-js": "^1.0.38",
182184
"unorm": "^1.6.0",
183185
"utf8": "^3.0.0",
186+
"uuid": "^11.1.0",
184187
"vkbeautify": "^0.99.3",
185188
"xpath": "0.0.34",
186189
"xregexp": "^5.1.1",

src/core/config/Categories.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
"To Upper case",
295295
"To Lower case",
296296
"Swap case",
297+
"Alternating Caps",
297298
"To Case Insensitive Regex",
298299
"From Case Insensitive Regex",
299300
"Add line numbers",
@@ -369,6 +370,7 @@
369370
"Regular expression",
370371
"XPath expression",
371372
"JPath expression",
373+
"Jsonata Query",
372374
"CSS selector",
373375
"Extract EXIF",
374376
"Extract ID3",
@@ -405,6 +407,7 @@
405407
"name": "Hashing",
406408
"ops": [
407409
"Analyse hash",
410+
"Generate all checksums",
408411
"Generate all hashes",
409412
"MD2",
410413
"MD4",
@@ -423,6 +426,7 @@
423426
"Snefru",
424427
"BLAKE2b",
425428
"BLAKE2s",
429+
"BLAKE3",
426430
"GOST Hash",
427431
"Streebog",
428432
"SSDEEP",
@@ -447,7 +451,8 @@
447451
"Adler-32 Checksum",
448452
"Luhn Checksum",
449453
"CRC Checksum",
450-
"TCP/IP Checksum"
454+
"TCP/IP Checksum",
455+
"XOR Checksum"
451456
]
452457
},
453458
{
@@ -546,6 +551,7 @@
546551
"Pseudo-Random Number Generator",
547552
"Generate De Bruijn Sequence",
548553
"Generate UUID",
554+
"Analyse UUID",
549555
"Generate TOTP",
550556
"Generate HOTP",
551557
"Generate QR Code",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* @author sw5678
3+
* @copyright Crown Copyright 2023
4+
* @license Apache-2.0
5+
*/
6+
7+
import Operation from "../Operation.mjs";
8+
9+
/**
10+
* Alternating caps operation
11+
*/
12+
class AlternatingCaps extends Operation {
13+
14+
/**
15+
* AlternatingCaps constructor
16+
*/
17+
constructor() {
18+
super();
19+
20+
this.name = "Alternating Caps";
21+
this.module = "Default";
22+
this.description = "Alternating caps, also known as studly caps, sticky caps, or spongecase is a form of text notation in which the capitalization of letters varies by some pattern, or arbitrarily. An example of this would be spelling 'alternative caps' as 'aLtErNaTiNg CaPs'.";
23+
this.infoURL = "https://en.wikipedia.org/wiki/Alternating_caps";
24+
this.inputType = "string";
25+
this.outputType = "string";
26+
this.args= [];
27+
}
28+
29+
/**
30+
* @param {string} input
31+
* @param {Object[]} args
32+
* @returns {string}
33+
*/
34+
run(input, args) {
35+
let output = "";
36+
let previousCaps = true;
37+
for (let i = 0; i < input.length; i++) {
38+
// Check if the element is a letter
39+
if (!RegExp(/^\p{L}/, "u").test(input[i])) {
40+
output += input[i];
41+
} else if (previousCaps) {
42+
output += input[i].toLowerCase();
43+
previousCaps = false;
44+
} else {
45+
output += input[i].toUpperCase();
46+
previousCaps = true;
47+
}
48+
}
49+
return output;
50+
}
51+
}
52+
53+
export default AlternatingCaps;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @author n1474335 [[email protected]]
3+
* @copyright Crown Copyright 2023
4+
* @license Apache-2.0
5+
*/
6+
7+
import * as uuid from "uuid";
8+
9+
import Operation from "../Operation.mjs";
10+
import OperationError from "../errors/OperationError.mjs";
11+
12+
/**
13+
* Analyse UUID operation
14+
*/
15+
class AnalyseUUID extends Operation {
16+
17+
/**
18+
* AnalyseUUID constructor
19+
*/
20+
constructor() {
21+
super();
22+
23+
this.name = "Analyse UUID";
24+
this.module = "Crypto";
25+
this.description = "Tries to determine information about a given UUID and suggests which version may have been used to generate it";
26+
this.infoURL = "https://wikipedia.org/wiki/Universally_unique_identifier";
27+
this.inputType = "string";
28+
this.outputType = "string";
29+
this.args = [];
30+
}
31+
32+
/**
33+
* @param {string} input
34+
* @param {Object[]} args
35+
* @returns {string}
36+
*/
37+
run(input, args) {
38+
try {
39+
const uuidVersion = uuid.version(input);
40+
return "UUID version: " + uuidVersion;
41+
} catch (error) {
42+
throw new OperationError("Invalid UUID");
43+
}
44+
}
45+
46+
}
47+
48+
export default AnalyseUUID;

src/core/operations/BLAKE3.mjs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* @author xumptex [[email protected]]
3+
* @copyright Crown Copyright 2025
4+
* @license Apache-2.0
5+
*/
6+
7+
import Operation from "../Operation.mjs";
8+
import OperationError from "../errors/OperationError.mjs";
9+
import { blake3 } from "hash-wasm";
10+
/**
11+
* BLAKE3 operation
12+
*/
13+
class BLAKE3 extends Operation {
14+
15+
/**
16+
* BLAKE3 constructor
17+
*/
18+
constructor() {
19+
super();
20+
21+
this.name = "BLAKE3";
22+
this.module = "Hashing";
23+
this.description = "Hashes the input using BLAKE3 (UTF-8 encoded), with an optional key (also UTF-8), and outputs the result in hexadecimal format.";
24+
this.infoURL = "https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE3";
25+
this.inputType = "string";
26+
this.outputType = "string";
27+
this.args = [
28+
{
29+
"name": "Size (bytes)",
30+
"type": "number"
31+
}, {
32+
"name": "Key",
33+
"type": "string",
34+
"value": ""
35+
}
36+
];
37+
}
38+
39+
/**
40+
* @param {string} input
41+
* @param {Object[]} args
42+
* @returns {string}
43+
*/
44+
run(input, args) {
45+
const key = args[1];
46+
const size = args[0];
47+
// Check if the user want a key hash or not
48+
if (key === "") {
49+
return blake3(input, size*8);
50+
} if (key.length !== 32) {
51+
throw new OperationError("The key must be exactly 32 bytes long");
52+
}
53+
return blake3(input, size*8, key);
54+
}
55+
56+
}
57+
58+
export default BLAKE3;

src/core/operations/ECDSAVerify.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
99
import { fromBase64 } from "../lib/Base64.mjs";
1010
import { toHexFast } from "../lib/Hex.mjs";
1111
import r from "jsrsasign";
12+
import Utils from "../Utils.mjs";
1213

1314
/**
1415
* ECDSA Verify operation
@@ -59,6 +60,11 @@ class ECDSAVerify extends Operation {
5960
name: "Message",
6061
type: "text",
6162
value: ""
63+
},
64+
{
65+
name: "Message format",
66+
type: "option",
67+
value: ["Raw", "Hex", "Base64"]
6268
}
6369
];
6470
}
@@ -70,7 +76,7 @@ class ECDSAVerify extends Operation {
7076
*/
7177
run(input, args) {
7278
let inputFormat = args[0];
73-
const [, mdAlgo, keyPem, msg] = args;
79+
const [, mdAlgo, keyPem, msg, msgFormat] = args;
7480

7581
if (keyPem.replace("-----BEGIN PUBLIC KEY-----", "").length === 0) {
7682
throw new OperationError("Please enter a public key.");
@@ -145,7 +151,8 @@ class ECDSAVerify extends Operation {
145151
throw new OperationError("Provided key is not a public key.");
146152
}
147153
sig.init(key);
148-
sig.updateString(msg);
154+
const messageStr = Utils.convertToByteString(msg, msgFormat);
155+
sig.updateString(messageStr);
149156
const result = sig.verify(signatureASN1Hex);
150157
return result ? "Verified OK" : "Verification Failure";
151158
}

0 commit comments

Comments
 (0)