Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 05D9E4763D0 for ; Tue, 21 Jan 2003 23:16:11 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 45715475EBB for ; Tue, 21 Jan 2003 23:16:10 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.4) with ESMTP-TLS id 1572401; Tue, 21 Jan 2003 20:50:17 -0800 Message-ID: <3E2E1AA5.4060205@joeconway.com> Date: Tue, 21 Jan 2003 20:14:29 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Woollard Cc: pgsql-php@postgresql.org Subject: Re: Password Encryption to replicate MySQL PASSWORD function References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/31 X-Sequence-Number: 1776 Luke Woollard wrote: > In mysql I have used the 'PASSWORD('someString')' function to encrypt each > users password. When authenticating a user for system use, I use the same > function to compare encrypted password. > From the MySQL manual: "The PASSWORD() function is used by the authentication system in MySQL Server, you should *not* use it in your own applications. For that purpose, use MD5() or SHA1() instead." (emphasis added) FWIW, the algorithm used in PASSWORD() must be pretty weak, as it appears to only create an 8-byte (16 hex chars) hash. MD5() (16 bytes/32 hex chars) and SHA1() (20 bytes/40 hex chars) are available in contrib/pgcrypto. Alternatively you could use the PHP functions by the same names. HTH, Joe