Skip to main content

Categories: Cryptography

SHA, SHA1

Returns the SHA-1 hash of the input as a 40-character hexadecimal string. SHA and SHA1 are aliases.

Syntax​

SHA(expression any) → varchar​

  • expression: Value to hash. Accepts any type.

Examples

SHA example
SELECT SHA('Dremio')
-- dda3f1ef53d1e82a4845ef5b2893b9d9c04bd3b1
Compute the SHA-1 hash of a string
SELECT SHA('hello')
-- aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d

SHA1(expression any) → varchar​

  • expression: Value to hash. Accepts any type.

Examples

SHA1 example
SELECT SHA1('Dremio')
-- dda3f1ef53d1e82a4845ef5b2893b9d9c04bd3b1
Compute the SHA-1 hash of a string
SELECT SHA1('hello')
-- aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
Compute the SHA-1 hash of a NULL value
SELECT SHA1(NULL)
-- null