]> granicus.if.org Git - postgresql/commitdiff
Add variants of digest() and hmac() that accept text inputs.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 7 Jan 2002 18:56:09 +0000 (18:56 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 7 Jan 2002 18:56:09 +0000 (18:56 +0000)
 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 :)

contrib/pgcrypto/pgcrypto.sql.in

index bb5b4c167f0074ddbd8dd0e2c5283762b3d4e28c..3efb2ed9693e711f8f0379173ba939034655d9c8 100644 (file)
@@ -1,6 +1,8 @@
 
+-- drop function digest(text, text);
 -- drop function digest(bytea, text);
 -- drop function digest_exists(text);
+-- drop function hmac(text, text, text);
 -- drop function hmac(bytea, bytea, text);
 -- drop function hmac_exists(text);
 -- drop function crypt(text, text);
 
 
 
+CREATE FUNCTION digest(text, text) RETURNS bytea
+  AS 'MODULE_PATHNAME',
+  'pg_digest' LANGUAGE 'C';
+
 CREATE FUNCTION digest(bytea, text) RETURNS bytea
   AS 'MODULE_PATHNAME',
   'pg_digest' LANGUAGE 'C';
@@ -22,6 +28,10 @@ CREATE FUNCTION digest_exists(text) RETURNS bool
   AS 'MODULE_PATHNAME',
   'pg_digest_exists' LANGUAGE 'C';
 
+CREATE FUNCTION hmac(text, text, text) RETURNS bytea
+  AS 'MODULE_PATHNAME',
+  'pg_hmac' LANGUAGE 'C';
+
 CREATE FUNCTION hmac(bytea, bytea, text) RETURNS bytea
   AS 'MODULE_PATHNAME',
   'pg_hmac' LANGUAGE 'C';