Crypt in queries and functions?

From: Owen Jacobson <ojacobson(at)mx-deus(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Crypt in queries and functions?
Date: 2003-01-30 02:24:32
Message-ID: 3E388CE0.2020300@mx-deus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Salve.

I'm writing Yet Another Web Forum and I'm using pgsql as the backend.
I'd like to do user creation and authentication through functions,
rather like:

SELECT Create_User ('Owen', 'password', 'ojacobson(at)mx-deus(dot)net');

Passwords should, for obvious reasons, be stored encrypted. I'm
inclined to do this in a unixish way, using crypt(). However, there
doesn't seem to be a crypt function in PostgreSQL's function list. How
would I go about wrapping or importing the C one? Is there a better way?

Ideally I'd like to be able to do something like

(table Users has column Password as varchar)

SELECT * FROM Users WHERE crypt('untested password', Password) = Password;

to verify passwords.

Any thoughts?

Owen

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Zavalin 2003-01-30 02:35:44 db dump
Previous Message Matt Block 2003-01-30 02:24:28 unsubscribe