gchq/CyberChef · error · OperationError

Unknown algorithm version: ${version}

Error message

Unknown algorithm version: ${version}

What it means

Thrown by the GOST Decrypt operation's version switch when the `Algorithm` argument string does not match one of the three supported case labels ("GOST 28147 (1989)", "GOST R 34.12 (Magma, 2015)", "GOST R 34.12 (Kuznyechik, 2015)"). The operation maps that label to an internal versionNum/blockLength pair; an unmatched label leaves those variables undefined, so the switch bails. In the browser UI this is normally unreachable because the value comes from a constrained `argSelector`, but via the Node API or a hand-built recipe any other string reaches the default.

Source

Thrown at src/core/operations/GOSTDecrypt.mjs:121

        const iv = toHexFast(Utils.convertToByteArray(ivObj.string, ivObj.option));
        input = inputType === "Hex" ? input : toHexFast(Utils.strToArrayBuffer(input));

        let blockLength, versionNum;
        switch (version) {
            case "GOST 28147 (1989)":
                versionNum = 1989;
                blockLength = 64;
                break;
            case "GOST R 34.12 (Magma, 2015)":
                versionNum = 2015;
                blockLength = 64;
                break;
            case "GOST R 34.12 (Kuznyechik, 2015)":
                versionNum = 2015;
                blockLength = 128;
                break;
            default:
                throw new OperationError(`Unknown algorithm version: ${version}`);
        }

        const sBoxVal = versionNum === 1989 ? sBox : null;

        const algorithm = {
            version: versionNum,
            length: blockLength,
            mode: "ES",
            sBox: sBoxVal,
            block: blockMode,
            keyMeshing: keyMeshing,
            padding: padding
        };

        try {
            const Hex = CryptoGost.coding.Hex;
            if (iv) algorithm.iv = Hex.decode(iv);

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Match the version string exactly to one of the three declared option labels; copy the literal from the op's args definition rather than retyping it.
  2. If building recipes programmatically, read the allowed values from `GOSTDecrypt.args[4].value[].name` instead of string literals.
  3. When replaying an old recipe, regenerate the GOST Decrypt step in the UI so it stores a current label.

Example fix

// before
const recipe = [{ op: "GOST Decrypt", args: [key, iv, "Hex", "Raw", "GOST 28147-89", /*...*/] }];
// after
const recipe = [{ op: "GOST Decrypt", args: [key, iv, "Hex", "Raw", "GOST 28147 (1989)", /*...*/] }];
Defensive patterns

Strategy: validation

Validate before calling

const VALID_GOST_VERSIONS = ["GOST 28147 (1989)", "GOST R 34.12 (Magma, 2015)", "GOST R 34.12 (Kuznyechik, 2015)"];
if (!VALID_GOST_VERSIONS.includes(version)) {
  throw new Error(`Bad version ${JSON.stringify(version)}. Valid: ${VALID_GOST_VERSIONS.join(", ")}`);
}

Type guard

/** @param {string} v */
function isGostVersion(v) {
  return ["GOST 28147 (1989)", "GOST R 34.12 (Magma, 2015)", "GOST R 34.12 (Kuznyechik, 2015)"].includes(v);
}

Prevention

When it happens

Trigger: Calling chef.bake / Recipe.run with a GOST Decrypt op whose `version` arg is misspelled, differently cased, or a legacy label (e.g. "GOST 28147-89", "Magma", "Kuznyechik", or the raw year "1989"). Loading a saved recipe JSON authored against an older CyberChef version whose label text has since changed.

Common situations: Upgrading CyberChef and replaying an old recipe; copy-pasting an op config from docs that uses a short-form name; programmatic recipe construction that hardcodes a version string instead of reusing the op's declared `args[4].value` option list.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/b55953782700f9bb. Report an issue: GitHub.