Re: field with Password

From: Iñigo Barandiaran <ibarandiaran(at)vicomtech(dot)org>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: field with Password
Date: 2009-02-04 14:37:27
Message-ID: 4989A827.5060104@vicomtech.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Raymond !!!!<br>
<br>
That is something I wanted! It's Great if it is already integrated in
Postgre! Superb. This is much more easy.<br>
<br>
Thank you All.<br>
<br>
Best,<br>
<blockquote cite="mid:4989A790(dot)7090401(at)gmail(dot)com" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
I&ntilde;igo Barandiaran wrote:
<blockquote cite="mid:49897455(dot)7080602(at)vicomtech(dot)org" type="cite">Thanks!
<br>
<br>
<br>
Ok. I've found <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://256.com/sources/md5/">http://256.com/sources/md5/</a>
library. So the idea is to
define in the dataBase a Field of PlainText type. When I want to insert
a new user, I define a password, convert to MD5 hash with the library
and store it in the DataBase. Afterwards, any user check should get the
content of the DataBase of do the inverse process with the library. Is
it correct? <br>
<br>
Thanks so much!!!!!! <br>
<br>
Best, <br>
<br>
</blockquote>
Well, you can use the built-in md5 function for this purpose. For
instance, you could insert a password into the table with a statement
like:<br>
<br>
<blockquote>insert into auth_data (user_id, password) values (1,
md5('test'));<br>
</blockquote>
<br>
And compare the supplied password with something like:<br>
<br>
<blockquote>select true from auth_data where user_id = 1 and password
=
md5('test');<br>
</blockquote>
<br>
You don't need to depend on an external library for this functionality;
it's built right into Postgres. Personally, in my own apps I write in
PHP, I&nbsp; use a combination of sha1 and md5 to hash user passwords,
without depending on Postgres to do the hashing, but the effect is
basically the same.<br>
<br>
Raymond<br>
</blockquote>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.0 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emilie Laffray 2009-02-04 14:39:53 Re: Crash of Postgresql on Windows
Previous Message Raymond C. Rodgers 2009-02-04 14:34:56 Re: field with Password