Salted Hash icon

Salted Hash

Create a hash from a template string that includes a secret placeholder {{SALT}}.

Salted Hash

AI-generated

Overview

This node creates a salted hash from a template string that includes a secret placeholder {{SALT}}. It is useful for generating secure hashes that combine dynamic data from input items with a secret salt, commonly used for data integrity, authentication tokens, or secure identifiers. For example, hashing invoice numbers combined with a secret salt to produce a unique secure hash for each invoice.

Use Case Examples

  1. Generating a SHA-256 hash of a string template containing invoice and debt number fields combined with a secret salt.
  2. Creating a base64url encoded SHA-512 hash for secure token generation using dynamic input data and a secret salt.

Properties

Name Meaning
Algorithm Hash algorithm to use (SHA-256 or SHA-512).
Output Encoding Encoding used for the hash output (Hex or Base64 URL-safe).
Template Template string to build the input for hashing. Supports n8n expressions and must include the literal token {{SALT}} where the secret salt should be inserted.
If {{SALT}} Is Missing Defines behavior if the template does not contain the {{SALT}} token: append, prepend the secret, or throw an error.
Output Field Name of the field in the output JSON where the resulting hash will be stored.

Output

JSON

- The resulting salted hash string stored under the user-defined output field name.

Dependencies

  • Requires an API key credential containing the secret salt used for hashing.

Troubleshooting

  • Error if the secret salt is missing in the credentials: Ensure the API key credential is properly configured with the secret.
  • Error if the template does not contain {{SALT}} and fallback is set to 'Error': Modify the template to include {{SALT}} or change the fallback behavior to append or prepend the secret.

Discussion