Documentation

gwp_hash


The `gwp_hash` modifier can be used to generate a hash of a field value with a specified algorithm and an optional salt. This can be useful for comparing data while hiding the actual value.
It is not recommended to use this feature for security purposes.

How to use

To utilize the `gwp_hash` modifier, you include it in your merge tag like this:

{YourField:1:gwp_hash algorithm="sha256" salt=""}

Parameters


algorithm: The hashing algorithm you wish to use. The default value is `sha256`, but you can specify any algorithm supported by your PHP installation’s `hash_algos()` function. If an unavailable hashing algorithm is specified, an error will be logged, and the original value will be returned.
salt: An optional salt value that can be appended to the data. This parameter supports nested merge tags for dynamic content.

Examples

If you have a field with ID 3 and want to hash its value using the `sha512` algorithm with a salt, you could write:

{FieldName:3:gwp_hash algorithm="md5" salt="*|AnotherField:4|*"}

This would generate a hash of the value in Field 3, using the MD5 algorithm and the value from Field 4 as a salt.

Frequently Asked Questions

What does the gwp_hash merge tag do?

 The gwp_hash modifier hashes the value of a Gravity Forms field using a selected algorithm, such as sha256 or md5. It’s perfect for generating non-reversible secure strings based on user input (e.g., obfuscating a user’s email or creating unique submission IDs).

{Email:1:gwp_hash algorithm="sha256"}

How do I add salt to the hash?

 To add salt (extra randomness) from another field, use a nested merge tag. Important: GravityWP requires a special syntax for nested tags — use *|…|* instead of {…}.

{Secret Code:1:gwp_hash algorithm="sha256" salt="*|Salt Value:3|*"}

This hashes the Secret Code (Field 1), with salt from Field 3.

Where should I place the gwp_hash merge tag?

 You should place the merge tag in the Default Value of a Hidden field. That way, the hashed value is generated automatically upon submission and saved with the entry.

Default Value: {Secret Code:1:gwp_hash algorithm="sha256"}

Alternatively, you can use a Text field with Administrative visibility, but you must enable this setting first:
GravityWP Settings → Advanced Merge Tags → “Replace field merge tags in Administrative Text fields”

Which hashing algorithms are supported?

Which hashing algorithms are supported?
The gwp_hash modifier uses PHP’s hash() function. That means you can use any valid algorithm supported by your PHP version, including:

-sha256
-sha1
-md5
-sha512
-ripemd160

{Email:1:gwp_hash algorithm="sha1"}

Does the gwp_hash merge tag work in calculations or conditional logic?

No, this modifier is not supported inside Gravity Forms calculations or conditional logic. It is intended only for storing hashed values, not for real-time comparisons.

Last updated: 21-07-2025

Advanced Merge Tagsv1.9.3

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more