X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 82ECFD1E12F for ; Thu, 29 Apr 2004 04:08:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 16075-01 for ; Thu, 29 Apr 2004 04:08:07 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 4313AD1B43A for ; Thu, 29 Apr 2004 04:08:06 -0300 (ADT) Received: from smtp-out2.xs4all.nl (smtp-out2.xs4all.nl [194.109.24.12]) by www.postgresql.com (Postfix) with ESMTP id 71579CF5439 for ; Thu, 29 Apr 2004 04:08:05 -0300 (ADT) Received: from localhost.localdomain (kiar.xs4all.nl [80.126.234.5]) by smtp-out2.xs4all.nl (8.12.10/8.12.10) with ESMTP id i3T77GLp018436 for ; Thu, 29 Apr 2004 09:07:24 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 500) id AA1D7B6EC4; Thu, 29 Apr 2004 09:07:16 +0200 (CEST) Date: Thu, 29 Apr 2004 09:07:16 +0200 From: Joolz To: list-postgresql-php Subject: MD5 in pg and php Message-ID: <20040429070716.GA6918@localhost.localdomain> Reply-To: pgsql-php@postgresql.org Mail-Followup-To: list-postgresql-php Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/49 X-Sequence-Number: 2706 Hi, I'm completely new to hashing, so please bear with me. I want to store passwords in a pg db, MD5 seems like a good way to enhance security (no more plaintext passwords over the line etc.) I had a look at MD5, in PHP 4.3.4 there is a function md5() which seems to work nicely: echo md5('apple'); returns ae6d32585ecc4d33cb8cd68a047d8434 every time. Apart from the PHP frontend, I also want to be able to use the same algorithm in native pg. I found that postgresql-contrib-7.3.4 has a function crypt() which I expected to work the same. However: select crypt('apple', gen_salt('md5')); gives values different from the PHP md5() function, and moreover, they're different each time. Can anyone please tell me what I should do to get the same result in native pg as in PHP? Thanks! -- 08:59-09:07 Fedora Core release 1 (Yarrow) Linux 2.4.22-1.2188.nptl