{"record":{"id":"2583f854535ad88d","repo":"gchq/CyberChef","slug":"unknown-algorithm-version-version-2583f8","errorCode":null,"errorMessage":"Unknown algorithm version: ${version}","messagePattern":"Unknown algorithm version: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GOSTKeyUnwrap.mjs","lineNumber":111,"sourceCode":"        const ukm = toHexFast(Utils.convertToByteArray(ukmObj.string, ukmObj.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: \"KW\",\n            sBox: sBoxVal,\n            keyWrapping: keyWrapping\n        };\n\n        try {\n            const Hex = CryptoGost.coding.Hex;\n            algorithm.ukm = Hex.decode(ukm);\n\n            const cipher = GostEngine.getGostCipher(algorithm);\n            const out = Hex.encode(cipher.unwrapKey(Hex.decode(key), Hex.decode(input)));","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GOSTKeyUnwrap.mjs#L93-L129","documentation":"Thrown by the GOST Key Unwrap operation's version switch when the `Algorithm` arg is not one of \"GOST 28147 (1989)\", \"GOST R 34.12 (Magma, 2015)\", \"GOST R 34.12 (Kuznyechik, 2015)\". The label selects versionNum and blockLength before the key-wrap engine is constructed; an unknown label is rejected up front.","triggerScenarios":"Programmatic recipe with a misspelled or legacy version string; replaying a recipe saved under a CyberChef version with different label text; passing the cipher's common name instead of the full label.","commonSituations":"Recipe migration; copy-pasting label text from third-party docs; locale differences.","solutions":["Use one of the three declared option labels verbatim.","Derive allowed values from `GOSTKeyUnwrap.args[4].value[].name` when scripting."],"exampleFix":"// before\nargs[4] = \"Magma 2015\";\n// after\nargs[4] = \"GOST R 34.12 (Magma, 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 labels from GOSTKeyUnwrap.args option list when scripting.","Regenerate older recipe steps after upgrades."],"tags":["crypto","gost","key-wrap","argument-validation"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}