Converts a string to a 256-bit hexadecimal SHA-2 hash.

The SHA256() function has two parameters:

  • stringToConvert (string): Required. The string to encode.
  • charSet (string): The character set to use for the encoding. The default value is UTF-8, but you can also use UTF-16 encoding.

To use this function, pass it a string.

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.

The function outputs a SHA-2 hash that uses UTF-16 encoding: 84b87f1ae08610f97a0bb6c228dd2289a54203c23ee2af17d617a1c1b4a0ab1a