pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Derrick Rice <derrick.rice@gmail.com>
Cc: Fred Cox <sailorfred@yahoo.com>
Cc: pgsql-docs@postgresql.org <pgsql-docs@postgresql.org>
Subject: Re: Algorithm for generating md5 encrypted password not found in documentation
Date: Thu, 27 Oct 2011 16:54:20 -0400 (EDT)
Message-ID: <201110272054.p9RKsKs18362@momjian.us> (raw)
In-Reply-To: <CANvs22EKm3PhQdFLXUCRVDR9AEwzqLqwYOC-AotM5+Y3EbZR5w@mail.gmail.com>

Derrick Rice wrote:
> On Thu, Oct 20, 2011 at 9:56 AM, Derrick Rice <derrick.rice@gmail.com> wrote:
> > If I recall correctly, it's the username and the password concatenated
> > and md5'd, then "md5" prepended.
> >
> > USER=...
> > PASS=...
> > MD5=`echo $USER$PASS | md5sum | cut -d' ' -f1`
> > echo "md5$MD5"
> 
> Figures I send the email then discover a small mistake.
> 
> It's password first.  So change $USER$PASS to $PASS$USER

We did document this for 9.2:

	http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#AEN92524

	AuthenticationMD5Password
	
	    The frontend must now send a PasswordMessage containing the password
	(with username) encrypted via MD5, then encrypted again using the 4-byte
	random salt specified in the AuthenticationMD5Password message. If this
	is the correct password, the server responds with an AuthenticationOk,
	otherwise it responds with an ErrorResponse. The actual PasswordMessage
	can be computed in SQL as concat('md5', md5(concat(md5(concat(password,
	username)), random-salt))). (Keep in mind the md5() function returns its
	result as a hex string.) 

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +



view thread (4+ messages)

Message-ID: <201110272054.p9RKsKs18362@momjian.us>
Permalink:  ../201110272054.p9RKsKs18362@momjian.us/
Also on:    postgresql.org/message-id/201110272054.p9RKsKs18362@momjian.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, derrick.rice@gmail.com, sailorfred@yahoo.com
  Subject: Re: Algorithm for generating md5 encrypted password not found in documentation
  In-Reply-To: <201110272054.p9RKsKs18362@momjian.us>

* 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