SHA256
Uses the US Secure Hash Algorithm 2 to calculate the SHA256 hash of string.
Uses the US Secure Hash Algorithm 2 to calculate the SHA256
hash of string. Returns the result as a VARCHAR
string in hexadecimal.
Behavior type
ImmutableSyntax
SHA256 ( string )
Arguments
string
- The
VARCHAR
orVARBINARY
string to be calculated.
Examples
The following examples calculate the SHA256
hash of the provided strings:
=> SELECT SHA256('abc');
SHA256
------------------------------------------------------------------
a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3
(1 row)
=> SELECT SHA256('Vertica'::bytea);
SHA256
------------------------------------------------------------------
9981b0b7df9f5be06e9e1a7f4ae2336a7868d9ab522b9a6ca6a87cd9ed95ba53
(1 row)
=> SELECT sha256('') = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' AS "TRUE";
TRUE
------
t
(1 row)