pgsql: Add user-callable SHA-2 functions

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add user-callable SHA-2 functions
Date: 2018-02-22 16:40:26
Message-ID: E1eotv0-00069Q-PT@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add user-callable SHA-2 functions

Add the user-callable functions sha224, sha256, sha384, sha512. We
already had these in the C code to support SCRAM, but there was no test
coverage outside of the SCRAM tests. Adding these as user-callable
functions allows writing some tests. Also, we have a user-callable md5
function but no more modern alternative, which led to wide use of md5 as
a general-purpose hash function, which leads to occasional complaints
about using md5.

Also mark the existing md5 functions as leak-proof.

Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/10cfce34c0fe20d2caed5750bbc5c315c0e4cc63

Modified Files
--------------
doc/src/sgml/func.sgml | 71 ++++++++++++-
src/backend/utils/adt/Makefile | 3 +-
src/backend/utils/adt/cryptohashes.c | 169 +++++++++++++++++++++++++++++++
src/backend/utils/adt/varlena.c | 48 ---------
src/include/catalog/pg_proc.h | 12 ++-
src/test/regress/expected/opr_sanity.out | 6 ++
src/test/regress/expected/strings.out | 53 ++++++++++
src/test/regress/sql/strings.sql | 18 ++++
8 files changed, 328 insertions(+), 52 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2018-02-22 20:14:26 pgsql: Fix perlcritic warnings
Previous Message Robert Haas 2018-02-22 16:10:54 pgsql: Be lazier about partition tuple routing.