{"record":{"id":"562d8ff0960338a3","repo":"gchq/CyberChef","slug":"unknown-algorithm-version-version-562d8f","errorCode":null,"errorMessage":"Unknown algorithm version: ${version}","messagePattern":"Unknown algorithm version: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GOSTVerify.mjs","lineNumber":108,"sourceCode":"        const mac = toHexFast(Utils.convertToByteArray(macObj.string, macObj.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: mac.length * 4\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 = cipher.verify(Hex.decode(key), Hex.decode(mac), Hex.decode(input));","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GOSTVerify.mjs#L90-L126","documentation":"Thrown by the GOST Verify 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-verify engine is built; an unknown value is rejected up front.","triggerScenarios":"Programmatic recipe with a misspelled/legacy version label; replaying an older recipe; 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 `GOSTVerify.args` option list when scripting."],"exampleFix":"// before\nargs[versionIndex] = \"Kuznyechik2015\";\n// after\nargs[versionIndex] = \"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 labels from GOSTVerify.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"}