How to interpret the salt sent in the AuthenticationMD5Password message from the server.

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: zenpolcorporation(at)gmail(dot)com
Subject: How to interpret the salt sent in the AuthenticationMD5Password message from the server.
Date: 2020-09-16 17:01:43
Message-ID: 160027570302.24369.6463926392340126344@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/protocol-message-types.html
Description:

I'm creating a postgresql client in gdscript (you can answer my question
even if you don't know how to code in gdscript).

To do this I use the postgresql protocol specification
(https://www.postgresql.org/docs/current/protocol-flow.html)

I managed to contact the server and it asks me for
"AuthenticationMD5Password", but I cannot identify myself. I followed the
procedure to generate the password described on the page but I get a server
error.

with this sql formula that I adapted in gdscript:

concat('md5', md5(concat(md5(concat(password, username)), random-salt)))
With "password" the value "test", "username" the value "test" and
"random-salt" the value "98dec364".

We obtain: md5936597c6b72ab2681ca01dca38b17da0

I get the following error: Message: password authentication failed for user
"test" SQLSTATE code: 28P01

it seems to come from salt, is the format really an ascii string or an
exadecimal string? I tried translating it to ascii and I get unprintable
characters and the server still gives me the same error.

In short, what is the format of the salt sent to the server?

In the documentation it seems that the bytes are ascii characters but that
doesn't work. Thank you in advance...

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2020-09-16 19:22:52 Re: How to interpret the salt sent in the AuthenticationMD5Password message from the server.
Previous Message Fujii Masao 2020-09-16 09:49:55 Re: Fix the example in the document of file-fdw