gchq/CyberChef · error · OperationError

Unknown algorithm version: ${version}

Error message

Unknown algorithm version: ${version}

What it means

Thrown by the GOST Encrypt operation's version switch when the `Algorithm` argument does not match one of the three supported labels ("GOST 28147 (1989)", "GOST R 34.12 (Magma, 2015)", "GOST R 34.12 (Kuznyechik, 2015)"). Identical in cause to the decrypt-side check: the label is used to pick an internal versionNum/blockLength, and an unmatched label is rejected before the cipher is built. UI option selection makes this hard to hit; malformed/legacy recipes do.

Source

Thrown at src/core/operations/GOSTEncrypt.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. Use exactly one of the three declared option labels, copied from the op's args definition.
  2. Derive allowed version strings programmatically from `GOSTEncrypt.args[4].value[].name`.
  3. Regenerate the GOST Encrypt step in the UI for older recipes.

Example fix

// before
args[4] = "Kuznyechik";
// after
args[4] = "GOST R 34.12 (Kuznyechik, 2015)";
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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: Programmatic recipe with a version string that doesn't exactly equal a declared option; replaying a recipe saved under a previous CyberChef release whose label text differs; passing the raw year or cipher name instead of the full label.

Common situations: Recipe migration across CyberChef versions; constructing op args from documentation that uses short names; locale/copy differences in the label string.

Related errors


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