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