gchq/CyberChef · error · OperationError
${err}
Error message
${err} What it means
Catch-all around `GostDigest.digest` in GOST Hash, re-raising any crypto-gost-js error as an OperationError. For the 1994 variant the sBox is attached; for newer variants the digest length is parsed from the `length` arg. Failures usually come from an invalid sBox name, a non-numeric/unsupported length, or malformed input passed to the digest engine.
Source
Thrown at src/core/operations/GOSTHash.mjs:85
const versionNum = version === "GOST 28147 (1994)" ? 1994 : 2012;
const algorithm = {
name: versionNum === 1994 ? "GOST 28147" : "GOST R 34.10",
version: versionNum,
mode: "HASH"
};
if (versionNum === 1994) {
algorithm.sBox = sBox;
} else {
algorithm.length = parseInt(length, 10);
}
try {
const gostDigest = new GostDigest(algorithm);
return toHexFast(gostDigest.digest(input));
} catch (err) {
throw new OperationError(err);
}
}
}
export default GOSTHash;
View on GitHub (pinned to 4290ea7539)
Solutions
- Use a supported digest length (typically 256 or 512 bits for GOST R 34.11-2012).
- For the 1994 variant, keep the default sBox (E-A / D-A) unless interop demands otherwise.
- Inspect the wrapped `err` for the exact library message.
Example fix
// before args = [inputType, "GOST R 34.11 (2012)", "128", includeNames, length]; // after args = [inputType, "GOST R 34.11 (2012)", "256", includeNames, length];
Defensive patterns
Strategy: try-catch
Validate before calling
const SUPPORTED_LENGTHS = ["256","512"];
if (variant !== "GOST R 34.11 (1994)" && !SUPPORTED_LENGTHS.includes(String(length))) {
throw new Error(`Unsupported digest length ${length}; use ${SUPPORTED_LENGTHS.join("/")} bits`);
} Type guard
function isSupportedLength(v){return["256","512"].includes(String(v));} Try / catch
try { chef.bake(input, recipe); }
catch (e) { if (/length|sbox|digest/i.test(e.message||"")) handleUserError(e); else throw e; } Prevention
- Use supported digest lengths (256/512 bits for 2012 variants).
- Keep the default sBox for the 1994 variant unless interop requires otherwise.
- Inspect the wrapped err for the library's message.
When it happens
Trigger: Selecting a 1994 hash variant with an sBox value the library rejects; choosing a 2012 variant with a length string that isn't a supported bit size (e.g. not 256/512); input that the digest engine cannot consume.
Common situations: Misreading the length field as bytes instead of bits; mixing an sBox intended for the block cipher into the hash op; older recipes using a length value no longer accepted by the vendored crypto-gost-js.
Related errors
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/3776fde82477e324.
Report an issue: GitHub.