gchq/CyberChef · error · OperationError
Unknown hash input type: ${inputType}
Error message
Unknown hash input type: ${inputType} What it means
Thrown by GenerateAllHashes.executeAlgo when a registered hash's `inputType` is not one of "arrayBuffer", "str", or "byteArray". The operation iterates an internal `hashes` table where each entry declares which input form the underlying algorithm expects; an unknown type means that table was built incorrectly or an entry was added without a valid inputType. It is effectively an internal/programmer error, not a user-input error.
Source
Thrown at src/core/operations/GenerateAllHashes.mjs:153
* @param {Function} algo - The hash or checksum algorithm
* @param {string} inputType
* @param {Object[]} [params=[]]
* @returns {string}
*/
executeAlgo(algo, inputType, params=[]) {
let digest = null;
switch (inputType) {
case "arrayBuffer":
digest = algo.run(this.inputArrayBuffer, params);
break;
case "str":
digest = algo.run(this.inputStr, params);
break;
case "byteArray":
digest = algo.run(this.inputByteArray, params);
break;
default:
throw new OperationError("Unknown hash input type: " + inputType);
}
return digest;
}
/**
* Formats the digest depending on user-specified arguments
* @param {string} digest
* @param {string} length
* @param {boolean} includeNames
* @param {string} name
* @returns {string}
*/
formatDigest(digest, length, includeNames, name) {
if (length !== "All" && (digest.length * 4) !== parseInt(length, 10))
return "";
if (!includeNames)View on GitHub (pinned to 4290ea7539)
Solutions
- If you forked/extended the op, set the hash entry's inputType to exactly "arrayBuffer", "str", or "byteArray".
- Add the new type as a switch case in executeAlgo if a genuinely new input form is required.
- Re-sync with upstream if the table was edited locally.
- File/track the issue against the operation rather than treating it as user data.
Example fix
// before
this.hashes.push({ name: "MyHash", algo: MyHash, inputType: "string", params: [] });
// after
this.hashes.push({ name: "MyHash", algo: MyHash, inputType: "str", params: [] }); Defensive patterns
Strategy: validation
Validate before calling
const VALID_INPUT_TYPES = ["arrayBuffer", "str", "byteArray"];
if (!VALID_INPUT_TYPES.includes(entry.inputType)) {
throw new Error(`Bad hash inputType ${JSON.stringify(entry.inputType)}; valid: ${VALID_INPUT_TYPES.join(", ")}`);
} Type guard
/** @param {string} t */
function isHashInputType(t){return["arrayBuffer","str","byteArray"].includes(t);} Prevention
- When adding a hash entry, set inputType to exactly "arrayBuffer", "str", or "byteArray".
- Add a matching switch case if introducing a new input form.
- Keep the hashes table and executeAlgo switch in sync; this error indicates drift.
When it happens
Trigger: Extending the `hashes`/`executeAlgo` mapping with a new hash but spelling inputType wrong (e.g. "string" instead of "str", "ArrayBuffer", "byte-array"); a stale fork where the table and the switch drifted out of sync; passing a malformed hash descriptor into the op.
Common situations: Contributing a new hash/checksum to CyberChef and forgetting the inputType enum; running a modified build where a hash entry's inputType field was renamed.
Related errors
- Invalid size
- Size must be greater than 0
- Invalid size
- Invalid Bech32 string: data part is too short (minimum 6 cha
- Invalid block cipher mode: ${mode}
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/90b470f09311e4a0.
Report an issue: GitHub.