Re: Encrypted column - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: Encrypted column
Date
Msg-id 4665161F.9090009@wildenhain.de
Whole thread Raw
In response to Encrypted column  (Ranieri Mazili <ranieri.oliveira@terra.com.br>)
Responses Re: Encrypted column
Re: Encrypted column
List pgsql-general
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

pgsql-general by date:

Previous
From: Marc Compte
Date:
Subject: Foreign keys and indexes
Next
From: Martijn van Oosterhout
Date:
Subject: Re: $libdir