From: | Mathias Mayrhofer <mtmayr(at)mtmayr(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | escape vs. bytea in config |
Date: | 2023-03-07 10:53:29 |
Message-ID: | ab608b9b-862b-c773-ea6f-298b9da6a898@mtmayr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dear Supportlist,
I came across the "bytea_output" configuration variable inside
postgresql.conf. It seems to be affecting the "digest" function, but in
a way I cannot understand.
When my postgresql 14 server executes the digest function, it considers
the "bytea_output" variable, but the output of the function is *NOT* the
same as the "encode" function. It differs only slightly.
Please have a view of the following two conditions: First with
"bytea_output = hex", second with "bytea_output = escape". In both ways
the result differs, which leads to my password-comparison to turn out false.
Regards,
Mathias
-- /etc/postgresql/14/main/postgresql.conf
-- bytea_output = 'hex'
db=> select digest('mtmayr', 'sha256');
┌────────────────────────────────────────────────────────────────────┐
│ digest │
├────────────────────────────────────────────────────────────────────┤
│ \xbf1995dd67c794df2de75983acd41f66c750682ab75ca3a935538b575884fd47 │
└────────────────────────────────────────────────────────────────────┘
db=> select encode(digest('mtmayr', 'sha256'), 'hex');
┌──────────────────────────────────────────────────────────────────┐
│ encode │
├──────────────────────────────────────────────────────────────────┤
│ bf1995dd67c794df2de75983acd41f66c750682ab75ca3a935538b575884fd47 │
└──────────────────────────────────────────────────────────────────┘
-- /etc/postgresql/14/main/postgresql.conf
-- bytea_output = 'escape'
db=> select encode(digest('mtmayr', 'sha256'), 'escape');
┌────────────────────────────────────────────────────────────────────────────────────────────┐
│ encode │
├────────────────────────────────────────────────────────────────────────────────────────────┤
│ \277\x19\225\335g\307\224\337-\347Y\203\254\324\x1Ff\307Ph*\267\\\243\2515S\213WX\204\375G │
└────────────────────────────────────────────────────────────────────────────────────────────┘
db=> select digest('mtmayr', 'sha256');
┌────────────────────────────────────────────────────────────────────────────────────────────┐
│ digest │
├────────────────────────────────────────────────────────────────────────────────────────────┤
│ \277\031\225\335g\307\224\337-\347Y\203\254\324\037f\307Ph*\267\\\243\2515S\213WX\204\375G │
└────────────────────────────────────────────────────────────────────────────────────────────┘
-- ^^ differences ^^^^
--
/\/\athias /\/\ayrhofer
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2023-03-07 12:35:09 | Re: escape vs. bytea in config |
Previous Message | Julien Rouhaud | 2023-03-07 07:00:50 | Re: Multiple core dump errors are thrown by initdb when Huge pages are enabled in OS and huge_pages is set to “off” in postgresql.conf.sample in Kubernetes. |