Re: MD5 in pg and php

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: MD5 in pg and php
Date: 2004-04-29 08:31:14
Message-ID: 4090BD52.9060708@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Joolz wrote:
> 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!
>

I whould suggest to update PG to version 7.4, where there is built-in
MD5 function.

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Stefan Sturm 2004-04-29 08:49:32 Re: MD5 in pg and php
Previous Message Christopher Kings-Lynne 2004-04-29 08:30:33 Re: MD5 in pg and php