sha2(msg: string, [digest_size: const int64]?) -> string

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.

Domain

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

Categories

Examples

make_col hashed_msg:sha2(msg, 256)

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