Jaa


sha2 function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns a checksum of the SHA-2 family as a hex string of expr.

Syntax

sha2(expr, bitLength)

Arguments

  • expr: A BINARY or STRING expression.
  • bitLength: An INTEGER expression.

Returns

A STRING.

bitLength can be 0, 224, 256, 384, or 512. bitLength 0 is equivalent to 256.

Examples

>> SELECT sha2('Spark', 256);
  529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b