{"record":{"id":"2ff178abbb704911","repo":"gchq/CyberChef","slug":"unknown-algorithm-version-version-2ff178","errorCode":null,"errorMessage":"Unknown algorithm version: ${version}","messagePattern":"Unknown algorithm version: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GOSTSign.mjs","lineNumber":114,"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: \"MAC\",\n            sBox: sBoxVal,\n            macLength: macLength\n        };\n\n        try {\n            const Hex = CryptoGost.coding.Hex;\n            if (iv) algorithm.iv = Hex.decode(iv);\n\n            const cipher = GostEngine.getGostCipher(algorithm);\n            const out = Hex.encode(cipher.sign(Hex.decode(key), Hex.decode(input)));","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GOSTSign.mjs#L96-L132","documentation":"Thrown by the GOST Sign (MAC) 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 sets versionNum/blockLength before the MAC engine is built; an unknown value is rejected up front.","triggerScenarios":"Programmatic recipe with a misspelled/legacy version label; replaying a recipe from an older CyberChef release; using the cipher's short name.","commonSituations":"Recipe migration; docs copy-paste; locale differences.","solutions":["Use one of the three declared option labels verbatim.","Derive allowed values from `GOSTSign.args` option list when scripting."],"exampleFix":"// before\nargs[versionIndex] = \"Magma\";\n// after\nargs[versionIndex] = \"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 GOSTSign.args option list when scripting.","Regenerate older recipe steps after upgrades."],"tags":["crypto","gost","mac","argument-validation"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}