pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Mathis <brian.mathis@gmail.com>
To: Tino Wildenhain <tino@wildenhain.de>
Cc: Ranieri Mazili <ranieri.oliveira@terra.com.br>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Encrypted column
Date: Tue, 5 Jun 2007 09:31:02 -0400
Message-ID: <183c528b0706050631q63c64a43t3981002ad822632d@mail.gmail.com> (raw)
In-Reply-To: <4665161F.9090009@wildenhain.de>
References: <46645B01.6070605@terra.com.br>
	<4665161F.9090009@wildenhain.de>

On 6/5/07, Tino Wildenhain <tino@wildenhain.de> wrote:
> Ranieri Mazili schrieb:
> > Hello,
> >
> > I need to store users and passwords on a table and I want to store it
> > encrypted, but I don't found documentation about it, how can I create a
> > table with columns "user" and "password" with column "password"
> > encrypted and how can I check if "user" and "password" are correct using
> > a sql query ?
>
> Passwords are usually not encrypted but hashed instead. A common hash
> function is available in postgres w/o any additional extension:
>
> md5()
>
> The rule is, if two hashes compare equal, then the original data must
> be equal (yes, there are chances for collisions, but practically very
> low. See also sha1 and friends in the pgcrypto contrib module)
>
> Regards
> Tino
>

Remember, you would also want to add some sort of salt before you ran
the hash, otherwise your password list is vulnerable to a simple
brute-force attack.



view thread (18+ messages)  latest in thread

Message-ID: <183c528b0706050631q63c64a43t3981002ad822632d@mail.gmail.com>
Permalink:  ../183c528b0706050631q63c64a43t3981002ad822632d@mail.gmail.com/
Also on:    postgresql.org/message-id/183c528b0706050631q63c64a43t3981002ad822632d@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: brian.mathis@gmail.com, tino@wildenhain.de, ranieri.oliveira@terra.com.br, pgsql-general@postgresql.org
  Subject: Re: Encrypted column
  In-Reply-To: <183c528b0706050631q63c64a43t3981002ad822632d@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox