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

  1. If you forked/extended the op, set the hash entry's inputType to exactly "arrayBuffer", "str", or "byteArray".
  2. Add the new type as a switch case in executeAlgo if a genuinely new input form is required.
  3. Re-sync with upstream if the table was edited locally.
  4. 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 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


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/90b470f09311e4a0. Report an issue: GitHub.