Skip to main content
Version: Next

Hash

Generate a hash of the text value using the Scrypt hash function under the hood. NULL values are kept.

Parameters

NameDescriptionDefaultRequiredSupported DB types
columnThe name of the column to be affectedYestext, varchar
saltHex encoded salt string. This value may be provided via environment variable GREENMASK_GLOBAL_SALTYestext, varchar
functionHash algorithm to anonymize data. Can be any of md5, sha1, sha256, sha512, sha3-224, sha3-254, sha3-384, sha3-512.sha1No-
max_lengthIndicates whether to truncate the hash tail and specifies at what length. Can be any integer number, where 0 means "no truncation".0No-

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
- 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 |

Copyright © GreenMask 2026