gchq/CyberChef · error · OperationError
Unknown algorithm version: ${version}
Error message
Unknown algorithm version: ${version} What it means
Thrown by the GOST Key Wrap operation's version switch when the `Algorithm` arg is not one of the three supported labels ("GOST 28147 (1989)", "GOST R 34.12 (Magma, 2015)", "GOST R 34.12 (Kuznyechik, 2015)"). The label selects versionNum/blockLength before the KW engine is built; an unmatched value is rejected before wrapping.
Source
Thrown at src/core/operations/GOSTKeyWrap.mjs:111
const ukm = toHexFast(Utils.convertToByteArray(ukmObj.string, ukmObj.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: "KW",
sBox: sBoxVal,
keyWrapping: keyWrapping
};
try {
const Hex = CryptoGost.coding.Hex;
algorithm.ukm = Hex.decode(ukm);
const cipher = GostEngine.getGostCipher(algorithm);
const out = Hex.encode(cipher.wrapKey(Hex.decode(key), Hex.decode(input)));View on GitHub (pinned to 4290ea7539)
Solutions
- Use one of the three declared option labels verbatim.
- Derive allowed values from `GOSTKeyWrap.args[4].value[].name` when scripting.
Example fix
// before args[4] = "28147"; // after args[4] = "GOST 28147 (1989)";
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
- Reuse labels from GOSTKeyWrap.args option list when scripting.
- Regenerate older recipe steps after upgrades.
When it happens
Trigger: Programmatic recipe with a misspelled/legacy version string; replaying an older recipe whose label text differs; using the cipher's short name instead of the full label.
Common situations: Recipe migration across CyberChef versions; docs copy-paste; locale differences.
Related errors
- Unknown algorithm version: ${version}
- Unknown algorithm version: ${version}
- Unknown algorithm version: ${version}
- Incorrect input length. Must be a multiple of the block size
- ${err}
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/84319dd384112957.
Report an issue: GitHub.