Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D83839FC159; Tue, 5 Jun 2007 10:05:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 34836-07-2; Tue, 5 Jun 2007 10:05:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 7195A9FC3AE; Tue, 5 Jun 2007 04:52:08 -0300 (ADT) Received: from [145.228.94.105] (unknown [145.228.94.105]) by service-web.de (Postfix) with ESMTP id 67836200160; Tue, 5 Jun 2007 09:52:03 +0200 (CEST) Message-ID: <4665161F.9090009@wildenhain.de> Date: Tue, 05 Jun 2007 09:51:59 +0200 From: Tino Wildenhain User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: Ranieri Mazili Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org Subject: Re: Encrypted column References: <46645B01.6070605@terra.com.br> In-Reply-To: <46645B01.6070605@terra.com.br> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/375 X-Sequence-Number: 115198 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