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 fingerprinting file contents. For example, you can use it to generate SHA-256 hashes of uploaded documents to detect duplicates or ensure files have not been tampered with.
Properties
| Name | Meaning |
|---|---|
| Hash Algorithm | The hashing algorithm to apply. Options: SHA-256, MD5, SHA-1, SHA-512, SHA-384, RIPEMD160, WHIRLPOOL |
| Input Binary Field | The name of the input binary field containing the file to be hashed (default: "data") |
| Output Hash Field | The name of the JSON field where the resulting hash string will be stored (default: "hash") |
Output
The node outputs the original input data with an additional JSON field containing the computed hash string. The field name is configurable and holds the hexadecimal representation of the hash digest. The binary data remains unchanged in the output.
Example output JSON snippet:
{
"originalField1": "value1",
"hash": "3a7bd3e2360a...f9c8d"
}
No binary data is generated or modified by this node; it only reads binary input and appends the hash result as JSON.
Dependencies
- Uses Node.js built-in
cryptomodule for hashing. - Requires the input data to be available as binary in the specified input binary field.
- No external API keys or services are needed.
Troubleshooting
- Common issues:
- Specifying a non-existent binary input field will cause the node to fail retrieving the binary data buffer.
- Using an unsupported or misspelled hash algorithm option may cause runtime errors.
- Error messages:
- Errors related to missing binary data typically indicate the input binary field name is incorrect or the previous node did not provide binary data.
- Hash algorithm errors usually mean the selected algorithm is invalid or not supported by the underlying crypto library.
- Resolutions:
- Verify the binary field name matches exactly the field containing the file data.
- Ensure the chosen hash algorithm is one of the supported options listed in the properties.
- Confirm that the input data actually contains binary content before this node.