pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Luke Woollard <luke@taborvision.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Password Encryption to replicate MySQL PASSWORD function
Date: Tue, 21 Jan 2003 20:14:29 -0800
Message-ID: <3E2E1AA5.4060205@joeconway.com> (raw)
In-Reply-To: <NGBBIAJCILLOIJPKMOIFEECECMAA.luke@taborvision.com>
References: <NGBBIAJCILLOIJPKMOIFEECECMAA.luke@taborvision.com>

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




view thread (6+ messages)  latest in thread

Message-ID: <3E2E1AA5.4060205@joeconway.com>
Permalink:  ../3E2E1AA5.4060205@joeconway.com/
Also on:    postgresql.org/message-id/3E2E1AA5.4060205@joeconway.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: mail@joeconway.com, luke@taborvision.com
  Subject: Re: Password Encryption to replicate MySQL PASSWORD function
  In-Reply-To: <3E2E1AA5.4060205@joeconway.com>
  References: <NGBBIAJCILLOIJPKMOIFEECECMAA.luke@taborvision.com> <3E2E1AA5.4060205@joeconway.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