Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f43Ck7A33059 for ; Thu, 3 May 2001 08:46:07 -0400 (EDT) (envelope-from darcy@druid.net) Received: by druid.net (Postfix, from userid 1000) id 5E9E11A77; Thu, 3 May 2001 08:46:07 -0400 (EDT) Subject: Re: How to encode and decode password in pgsql !! In-Reply-To: <1070.192.168.0.5.988745877.squirrel@mail.archeanit.net> "from Subhramanya Shiva at May 2, 2001 01:07:57 am" To: Subhramanya Shiva Date: Thu, 3 May 2001 08:46:07 -0400 (EDT) Cc: pgsql-sql@postgresql.org Reply-To: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20010503124607.5E9E11A77@druid.net> From: darcy@druid.net (D'Arcy J.M. Cain) X-Archive-Number: 200105/10 X-Sequence-Number: 2808 Thus spake Subhramanya Shiva > how to store password details in a table. in encoded form > and how to decode it. > > in mysql ...we r having encoding and decoding for a password > security ... so how to do in pgsql... You use the chkpass type that I just commited to the distribution (finally.) Here is an example of its usage. darcy=# CREATE TABLE x (i serial, p chkpass); NOTICE: CREATE TABLE will create implicit sequence 'x_i_seq' for SERIAL column 'x.i' NOTICE: CREATE TABLE/UNIQUE will create implicit index 'x_i_key' for table 'x' CREATE darcy=# INSERT INTO x (p) VALUES ('hello'); INSERT 805247 1 darcy=# INSERT INTO x (p) VALUES ('goodbye'); INSERT 805248 1 darcy=# SELECT * FROM x; i | p ---+---------------- 1 | :SoLA2YFpQYV/I 2 | :Sg8CKkFqqTGec (2 rows) darcy=# SELECT p = 'hello' FROM x WHERE i = 1; ?column? ---------- t (1 row) darcy=# SELECT p = 'hello' FROM x WHERE i = 2; ?column? ---------- f (1 row) darcy=# SELECT i, raw(p) FROM x; i | raw ---+--------------- 1 | SoLA2YFpQYV/I 2 | Sg8CKkFqqTGec (2 rows) -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.