Add user-callable SHA-2 functions
Peter Eisentraut <peter_e@gmx.net>
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@paquier.xyz>
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +70 −1 |
| src/backend/utils/adt/cryptohashes.c | added | +169 −0 |
| src/backend/utils/adt/Makefile | modified | +2 −1 |
| src/backend/utils/adt/varlena.c | modified | +0 −48 |
| src/include/catalog/pg_proc.h | modified | +10 −2 |
| src/test/regress/expected/opr_sanity.out | modified | +6 −0 |
| src/test/regress/expected/strings.out | modified | +53 −0 |
| src/test/regress/sql/strings.sql | modified | +18 −0 |