{"record":{"id":"0088a1f4333feb83","repo":"gchq/CyberChef","slug":"unknown-algorithm-version-version-0088a1","errorCode":null,"errorMessage":"Unknown algorithm version: ${version}","messagePattern":"Unknown algorithm version: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GOSTEncrypt.mjs","lineNumber":121,"sourceCode":"        const iv = toHexFast(Utils.convertToByteArray(ivObj.string, ivObj.option));\n        input = inputType === \"Hex\" ? input : toHexFast(Utils.strToArrayBuffer(input));\n\n        let blockLength, versionNum;\n        switch (version) {\n            case \"GOST 28147 (1989)\":\n                versionNum = 1989;\n                blockLength = 64;\n                break;\n            case \"GOST R 34.12 (Magma, 2015)\":\n                versionNum = 2015;\n                blockLength = 64;\n                break;\n            case \"GOST R 34.12 (Kuznyechik, 2015)\":\n                versionNum = 2015;\n                blockLength = 128;\n                break;\n            default:\n                throw new OperationError(`Unknown algorithm version: ${version}`);\n        }\n\n        const sBoxVal = versionNum === 1989 ? sBox : null;\n\n        const algorithm = {\n            version: versionNum,\n            length: blockLength,\n            mode: \"ES\",\n            sBox: sBoxVal,\n            block: blockMode,\n            keyMeshing: keyMeshing,\n            padding: padding\n        };\n\n        try {\n            const Hex = CryptoGost.coding.Hex;\n            if (iv) algorithm.iv = Hex.decode(iv);\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GOSTEncrypt.mjs#L103-L139","documentation":"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.","triggerScenarios":"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.","commonSituations":"Recipe migration across CyberChef versions; constructing op args from documentation that uses short names; locale/copy differences in the label string.","solutions":["Use exactly one of the three declared option labels, copied from the op's args definition.","Derive allowed version strings programmatically from `GOSTEncrypt.args[4].value[].name`.","Regenerate the GOST Encrypt step in the UI for older recipes."],"exampleFix":"// before\nargs[4] = \"Kuznyechik\";\n// after\nargs[4] = \"GOST R 34.12 (Kuznyechik, 2015)\";","handlingStrategy":"validation","validationCode":"const VALID = [\"GOST 28147 (1989)\", \"GOST R 34.12 (Magma, 2015)\", \"GOST R 34.12 (Kuznyechik, 2015)\"];\nif (!VALID.includes(version)) throw new Error(`Bad version; valid: ${VALID.join(\", \")}`);","typeGuard":"function isGostVersion(v){return[\"GOST 28147 (1989)\",\"GOST R 34.12 (Magma, 2015)\",\"GOST R 34.12 (Kuznyechik, 2015)\"].includes(v);}","tryCatchPattern":null,"preventionTips":["Reuse option labels from GOSTEncrypt.args[4].value[].name when scripting.","Regenerate older recipe steps after CyberChef upgrades."],"tags":["crypto","gost","argument-validation","recipe-config"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}