Hashing and encoding

This topic describes how to encode data and create hashAlgorithm that encodes digital content using a unique combination of numbers and letters, making it uniquely identifiable. In email marketing, the generated hash values enable content to be uniquely identified without making personal data such as the email address visible. values using field functions.

Use your specific data and recipient list fields, and test the field functions before using them in a mailing.


Base64 is an encoding method to not display data in clear text.

Base64 is not an encryption method, as you can easily decode the encoded data.

To encode the content of a recipient list field using Base64, you can use the following Velocity code as a default replacement:


Since the contents of recipient list fields can also be empty (unknown, NULL value), the code example converts possible NULL values into empty string values.


MD5 is a hash method that lets you create checksums, for example to verify data integrity.

MD5 is not an encryption method. Hashing is not reversible. In addition, MD5 is not collision free, because different inputs can lead to the same hash value.

The following field function templates additionally use a key to increase the security factor:


#set ($key = "1234567890")
#set ($string = "STRINGWERT$key")


<odr:set var="key" value="1234567890" />
<odr:set var="string" value="STRINGWERT%{key}" />
<odr:out value="%{md5(string)}" />

MD5 and Base64

The following Velocity code uses a key (0123456789) for MD5 hashing. The recipient data is encoded using Base64. The code also checks if the recipient list field is empty. Finally, the function $StringHelper.md5() generates a hash value from the sequential Base64 values.

#set($key = "0123456789")
#set($email = "$bmMisc.encodeBase64($!user.data.email)")
  #set($salutation = "$bmMisc.encodeBase64($!user.data.salutation)")
  #set($firstname = "$bmMisc.encodeBase64($!user.data.firstname)")
  #set($lastname = "$bmMisc.encodeBase64($!user.data.lastname)")
  #set($sender = "$bmMisc.encodeBase64($!user.data.sender)")
#set($name = "$bmMisc.encodeBase64($mailing.name)")
  #set($shopsource = "$bmMisc.encodeBase64($!user.data.shopsource)")
#set($string = "$!email$!salutation$!firstname$!lastname$!sender$!name$!shopsource$!key")


SHA256 is another method to create hash values from recipient data.

SHA256 can only process String values in Velocity.

To encode the content of a recipient list field using SHA256, you can use the following Velocity code as your default replacement:

#set($string = "STRINGVALUE")

SHA256 and Base64

The following Velocity Code uses SHA256 and Base64 to encode the recipient's email address: