Re: How to encrypt data in Postgresql - Mailing list pgsql-general

From Douglas Trainor
Subject Re: How to encrypt data in Postgresql
Date
Msg-id 3F204F96.5050608@uic.edu
Whole thread Raw
In response to How to encrypt data in Postgresql  ("Terence Chang" <TChang@nqueue.com>)
List pgsql-general
biguns> psql dados
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

dados=# select encode(digest('texto', 'md5'), 'hex');
              encode
----------------------------------
 62059a74e9330e9dc2f537f712b8797c
(1 row)

Of course, you'd probably have a field instead of 'texto', but you get
the idea.
And you will first need to suck in the contributed code from Marko Kreen
and the WIDE Project, which if you have the source will be in the directory
postgresql-7.3.3/contrib/pgcrypto

There are many variations on how you can use md5.  You could do it in PHP,
or you could do it closer to the database...

    douglas

Terence Chang wrote:

> Hi there:
>
> I know this might be an easy answer, but I was unable to figure out
> the solution.
>
> I would like to encrypt a password field in the table. I could not
> figure out how phpPGAdmin did.
>
> Should I use PHP's MD5 to encrypt the password? Is there a function in
> PostgreSQL that can encrypt the data with MD5?
>
> I would like to encrypt the data in PostgreSQL, so other program can
> use the same function. Can anyone give me some hints? What key word
> should I search in the document?
>
> Thansk!
>





pgsql-general by date:

Previous
From: greg@turnstep.com
Date:
Subject: Re: List last value of all sequences
Next
From: Dennis Gearon
Date:
Subject: Re: SAP DB: The unsung Open Source DB