Skip to main content
Version: 0.2

Hash

Generate a salted hash of the text value using the selected hash function. The result is hex-encoded. NULL values are always kept, the transformer has no keep_null parameter.

Parameters​

NameDescriptionDefaultRequiredSupported DB types
columnThe name of the column to be affectedYestext, varchar
saltSalt string written before the value into the hash. Taken from GREENMASK_GLOBAL_SALT if not set. Empty means no salt.No-
functionHash algorithm to anonymize data. Can be any of md5, sha1, sha256, sha512, sha3-224, sha3-254, sha3-384, sha3-512.sha3-254No-
max_lengthTruncate the hex-encoded hash to this many characters. 0 means no truncation. Must not be negative.0No-

The sha3-254 value selects the SHA3-256 algorithm.

Example: Generate hash from job title​

The following example generates a hash from the jobtitle into sha1 and truncates the results after the 10th character.

We can set the salt via the environment variable GREENMASK_GLOBAL_SALT:

export GREENMASK_GLOBAL_SALT="12343567baaa"
Hash transformer example
dump:
transformation:
- schema: "humanresources"
name: "employee"
transformers:
- name: "Hash"
params:
column: "jobtitle"
function: "sha1"
max_length: 10
Expected result

| column name | original value | transformed |
|-------------|----------------------------------|-------------|
| jobtitle | Research and Development Manager | 3a456da5c5 |

Tools and expertise for reproducible, production-like environments.
Copyright © 2026 Greenmask, Inc.
Privacy Policy