Overview
This node calculates the cryptographic hash of a binary file input using various hashing algorithms. It is useful for verifying data integrity, generating unique identifiers for files, or securely storing file fingerprints. For example, you can use it to generate SHA-512 hashes of uploaded documents to ensure they have not been tampered with or to create checksums for file comparison.
Properties
| Name | Meaning |
|---|---|
| Input Binary Field | The name of the input binary field containing the file whose hash will be calculated. |
| Output Hash Field | The name of the JSON field where the resulting hash string will be stored. |
The node also supports selecting the hash algorithm from these options:
SHA-256, MD5, SHA-1, SHA-512, SHA-384, RIPEMD160, WHIRLPOOL.
Output
The output contains the original input data with an additional JSON field holding the computed hash string. The field name is configurable (default is "hash"). The hash value is a hexadecimal string representing the digest of the input binary data.
If the input contained binary data, it is preserved unchanged in the output.
Dependencies
- Uses Node.js built-in
cryptomodule for hashing. - Requires the input binary data to be accessible via n8n's binary data handling helpers.
- No external API keys or services are needed.
Troubleshooting
- Common issues:
- If the specified input binary field does not exist or is empty, the node will fail to retrieve the binary data buffer, causing errors.
- Using unsupported or misspelled hash algorithm names will cause runtime errors.
- Error messages:
- Errors related to missing binary data typically indicate incorrect input field names; verify the "Input Binary Field" property matches the actual binary field name.
- Hash creation errors usually stem from invalid algorithm selection; ensure the chosen algorithm is one of the supported options.