The hash helper applies a cryptographic hash function to a string and returns the result in a specified encoding format. Use it to generate fingerprints, checksums, or one-way hashes of field values for verification or deduplication purposes.
Syntax
{{hash algorithm encoding field}}
algorithm -- The hashing algorithm to apply. Required. Examples: "md5", "sha1", "sha256". See Supported cryptographic encoding algorithms for all accepted values. Use stronger algorithms such as "sha256" in preference to "md5" or "sha1" for security-sensitive use cases.
encoding -- The output format of the hash. Required. Common values: "hex", "base64".
field -- The string or field value to hash. Required. Accepts a field reference or a literal string.
Examples
Hash a field value with MD5 and base64 encoding
{{hash "md5" "base64" record.name}}
Input: record.name is "Bob"
Output: the MD5 hash of "Bob" encoded as a base64 string.
Hash a literal string with SHA-256 and hex encoding
{{hash "sha256" "hex" "HelloWorld"}}
Output: the SHA-256 hash of "HelloWorld" as a hex string.
Usage notes
- Hash output is one-way and irreversible. To generate a keyed signature for authentication purposes, use the hmac helper instead.
- Use
"sha256"or stronger in preference to"md5"or"sha1"for security-sensitive use cases. - The input must be a string or a value convertible to a string.
- For additional options, see hashOptions fields for the hash helper.