Transforms
Hash
Compute a digest of the whole record or selected fields and store it on a key.
Overview
The Hash transformation computes a hash digest and writes its hex-encoded value to a key, leaving the rest of the record unchanged. It can hash either the entire record or a chosen subset of fields, and supports several algorithms.
- Whole record (no
fields) — the record is canonicalized first (object keys sorted recursively), so two records that differ only in key order produce the same digest. - Selected fields (
fieldsset) — only those field values are hashed. The field list is treated as a set, so["a","b"]and["b","a"]produce the same digest.
Common uses are creating a stable fingerprint for correlation, or precomputing a key you later deduplicate on.
Configuration
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| key | string | Yes | — | Path where the resulting hex digest is written |
| algorithm | string | No | sha256 | Hash algorithm: md5, sha1, sha256, or xxh128 |
| fields | array of strings | No | [] | Field paths to hash; empty hashes the whole record |
Example
Hash the whole record and store the digest under _fingerprint:
Code
Given the input record:
Code
The output adds the digest, leaving the rest untouched:
Code
To fingerprint only specific fields, set fields:
Code
Notes
- The digest is written as a lowercase hex string; the original fields are left in place.
- Default algorithm is
sha256. Usexxh128for a fast, non-cryptographic fingerprint. - Whole-record hashing is key-order independent (the record is canonicalized first).
- In
fieldsmode the field list is order-independent; a field that is present asnullor""still counts, but a wholly absent field simply contributes nothing to the digest. - The digests shown above are illustrative.
Last modified on