Crypt in queries and functions? - Mailing list pgsql-general

From Owen Jacobson
Subject Crypt in queries and functions?
Date
Msg-id 3E388CE0.2020300@mx-deus.net
Whole thread Raw
Responses Re: Crypt in queries and functions?
List 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@mx-deus.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


pgsql-general by date:

Previous
From: "Williams, Travis L, NPONS"
Date:
Subject: Re: Perl DBI and placeheld values
Next
From: "Matt Block"
Date:
Subject: unsubscribe