Impala hash functions

CDP now supports built-in functions to compute SHA-1 digest and SHA-2 family of hashing functions. This new function enables a data analyst to use queries where certain fields must have a one-way hash function applied to prevent the values of those fields from being displayed.

Support for SHA2 digest

Support for SHA2 digest includes SHA224, SHA256, SHA384, and SHA512. In FIPS mode SHA1, SHA224, and SHA256 have been disabled and throws an error.

SHA1 (s)

Input: Takes string as an argument.

Return type:

If the argument is null, return null else SHA1 digest.

SHA2 (s, bit_length)

Input: Takes string s and integer bit_length. Supported bit_length are 224, 256, 384, and 512.

Return type:

Returns SHA2 digest based on bit_length specified but throws an error on passing an unsupported bit length. If either of the argument is null, then null is returned.