SHA1

更新时间:
复制 MD 格式

Computes the SHA-1 hash of a STRING or BINARY expression and returns it as a hexadecimal string.

Syntax

string sha1(string|binary <expr>)

Parameters

expr: required. A STRING or BINARY value.

Return value

Returns a STRING value in hexadecimal string format. Returns null if the input is null.

Examples

Example 1: Compute the SHA-1 hash of 'ABC'.

select sha1('ABC');
-- 3c01bdbb26f358bab27f267924aa2c9a03fcfdb8

Example 2: Pass null as the input.

select sha1(null);
-- null

Related functions

For more information, see Other functions.