HASH.SHA256

HASH.SHA256 returns the hash calculated from the given string using SHA-256 algorithm. SHA-256 is used to generate a 32 byte (256 bit) hash. This function throws an error if it is passed an argument that is not a string.

Function category: Hash

Syntax

HASH.SHA256(arg)

Arguments

Description

arg

String.

Example

Example 1: Calculate a digest for a specific content

Let's say we have the following JSON for which we need to calculate the digest:

{
"data": {
"foo": 1,
"bar": ["x", "y"]
}
}

We can use JSON.ENCODE to transform the context into a string and pass that string to HASH.SHA256 to calculate the digest, as follows:

HASH.SHA256(JSON.ENCODE(_))

This will return the following digest:

5ebb5928da91aadae28a855d54d66a74c1ab6fb6d6ebf4f4689f2b310e62a637

Note: The HASH.MD5, HASH.SHA1, HASH.SHA384, and HASH.SHA512 are supported.