sha2

Description

Returns a hex-encoded string containing the N-bit SHA-2 message digest, where N is the specified output digest size.

Arguments

  1. msg (required) A string expression, the message to be hashed

  2. digest_size (optional) Size (in bits) of the output, corresponding to the specific SHA-2 function used to encrypt the string:

  • 224 = SHA-224

  • 256 = SHA-256 (Default)

  • 384 = SHA-384

  • 512 = SHA-512

SHA-512/224 and SHA-512/256 are not supported.

Return type

string

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

sha2(msg, [ digest_size ])

Argument

Type

Optional

Repeatable

Restrictions

msg

string

no

no

none

digest_size

int64

yes

no

constant

Examples

make_col hashed_msg:sha2(msg, 256)

Create a column ‘hashed_msg’ with the result of hashing the column ‘msg’ with SHA-256.