Contents
sha256()
A function computing a SHA-256 hash
sha256()
is a system function or computing the SHA-256 hash of the provided binary string.
sha256()
was added in PostgreSQL 11.
Examples
Basic usage example for sha256()
:
postgres=# SELECT sha256('foo'::bytea); sha256 -------------------------------------------------------------------- \x2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae (1 row)
Return the generated hash as a text
string:
postgres=# SELECT encode(sha256('foo'::bytea), 'hex'); encode ------------------------------------------------------------------ 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae (1 row)
References
- PostgreSQL documentation: Other Binary String Functions