Skip to content

Commit 6d6b3e9

Browse files
committed
Add variants of digest() and hmac() that accept text inputs.
Marko Kreen says: This is so obvious that I would like to make it 'official'. Seems like the theology around bytea<>text casting kept me from seeing the simple :)
1 parent 5b9a058 commit 6d6b3e9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

contrib/pgcrypto/pgcrypto.sql.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

2+
-- drop function digest(text, text);
23
-- drop function digest(bytea, text);
34
-- drop function digest_exists(text);
5+
-- drop function hmac(text, text, text);
46
-- drop function hmac(bytea, bytea, text);
57
-- drop function hmac_exists(text);
68
-- drop function crypt(text, text);
@@ -14,6 +16,10 @@
1416

1517

1618

19+
CREATE FUNCTION digest(text, text) RETURNS bytea
20+
AS 'MODULE_PATHNAME',
21+
'pg_digest' LANGUAGE 'C';
22+
1723
CREATE FUNCTION digest(bytea, text) RETURNS bytea
1824
AS 'MODULE_PATHNAME',
1925
'pg_digest' LANGUAGE 'C';
@@ -22,6 +28,10 @@ CREATE FUNCTION digest_exists(text) RETURNS bool
2228
AS 'MODULE_PATHNAME',
2329
'pg_digest_exists' LANGUAGE 'C';
2430

31+
CREATE FUNCTION hmac(text, text, text) RETURNS bytea
32+
AS 'MODULE_PATHNAME',
33+
'pg_hmac' LANGUAGE 'C';
34+
2535
CREATE FUNCTION hmac(bytea, bytea, text) RETURNS bytea
2636
AS 'MODULE_PATHNAME',
2737
'pg_hmac' LANGUAGE 'C';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy