how to encode/encrypt a string

From: Miles Keaton <mileskeaton(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to encode/encrypt a string
Date: 2004-09-30 15:36:23
Message-ID: 59b2d39b040930083654ef54d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

still doing my switch from MySQL to PgSQL, and can't figure out what
the comparable function would be for this:

In MySQL, to store a big secret (like a credit card number) in the
database that I didn't want anyone to be able to see without knowing
the salt/password value, I would do this into a blob-type field:

INSERT INTO clients(ccnum) VALUES (ENCODE(''433904123121309319', 'xyzzy'));

Then it would be stored as binary jumble in the database, only able to
be decoded with my "xyzzy" password.

SELECT DECODE(ccnum, 'xyzzy') FROM clients;

How would I do this same thing in PostgreSQL?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Claudia Restrepo Pajon - Practicante Sistemas 2004-09-30 16:13:54 POSTGRES
Previous Message Tom Lane 2004-09-30 14:48:51 Re: problems with lower() and unicode-databases