Converts a string to a 256-bit hexadecimal SHA-2 hash.
Availability
<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>✅ Yes</td> </tr> </table>Syntax
SHA256(stringToConvert, charSet)
The SHA256() function has two parameters:
stringToConvert(string): Required. The string to encode.charSet(string): The character set to use for encoding. Accepted values areUTF-8andUTF-16. The default value isUTF-8.
Usage
To use this function, pass it a string.
%%=SHA256("This is a string of text.")=%%
The function outputs a SHA-2 hash of the provided string: 99d1f7b534824f35dffa18c3b728ecb00c4585ba9d7c9b26205424f8f28eff8e
You can also generate the hash using UTF-16 encoding, as in this example.
%%=SHA256("This is a string of text.", "UTF-16")=%%
The function outputs a SHA-2 hash that uses UTF-16 encoding: 84b87f1ae08610f97a0bb6c228dd2289a54203c23ee2af17d617a1c1b4a0ab1a