Re: PASSWORD vs. md5('somepass')

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Alexander Reichstadt <lxr(at)mac(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PASSWORD vs. md5('somepass')
Date: 2012-03-20 15:55:56
Message-ID: CAK3UJRH1fnDkq6BxY+t9kNwnVb1DrBFEjKsWH6-B8m8kucYZNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 20, 2012 at 8:28 AM, Alexander Reichstadt <lxr(at)mac(dot)com> wrote:
> Hi,
>
> I look for a way to reproduce the encrypted string stored as a password by means other than using the CREATE ROLE command.
>
> When using CREATE ROLE........PASSWORD 'somepass' the resulting string for rolpassword in pg_authid always starts with md5, suggesting it would create some md5 string. So I thought to use SELECT md5('somepass') to get the same.
>
> But the two strings differ. Is there a function that does that outside the create role context?

See pg_authid's explanation of the rolpassword column:
http://www.postgresql.org/docs/9.1/static/catalog-pg-authid.html

which you can reproduce via:
SELECT 'md5' || MD5(role_password_here || role_name_here);

Josh

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chengjie Qin 2012-03-20 16:48:16 Initialize the User-defined Aggregate in ECPG
Previous Message Alexander Reichstadt 2012-03-20 15:28:30 PASSWORD vs. md5('somepass')