Re: SHA-2 functions

2018-02-22 Thread Peter Eisentraut
On 2/22/18 01:05, Michael Paquier wrote: > On Wed, Feb 21, 2018 at 03:45:17PM -0500, Peter Eisentraut wrote: >> On 2/20/18 23:04, Michael Paquier wrote: >>> I think that crypto_hash.c or hash_crypt.c would be adapted as well. >>> crypt.c is too much generic, so including both concepts in the name i

Re: SHA-2 functions

2018-02-21 Thread Michael Paquier
On Wed, Feb 21, 2018 at 03:45:17PM -0500, Peter Eisentraut wrote: > On 2/20/18 23:04, Michael Paquier wrote: >> I think that crypto_hash.c or hash_crypt.c would be adapted as well. >> crypt.c is too much generic, so including both concepts in the name is >> the way to go. The name given by Tom her

Re: SHA-2 functions

2018-02-21 Thread Peter Eisentraut
On 2/20/18 23:04, Michael Paquier wrote: > I think that crypto_hash.c or hash_crypt.c would be adapted as well. > crypt.c is too much generic, so including both concepts in the name is > the way to go. The name given by Tom here sounds actually nice. Updated patches -- Peter Eisentraut

Re: SHA-2 functions

2018-02-20 Thread Michael Paquier
On Tue, Feb 20, 2018 at 05:09:48PM -0500, Tom Lane wrote: > Peter Eisentraut writes: >> On 2/19/18 21:07, Michael Paquier wrote: >>> varlena.c is already large and messy. I would suggest to split into a >>> new file all the user-facing cryptographic functions, including md5 and >>> hex functions,

Re: SHA-2 functions

2018-02-20 Thread Tom Lane
Peter Eisentraut writes: > On 2/19/18 21:07, Michael Paquier wrote: >> varlena.c is already large and messy. I would suggest to split into a >> new file all the user-facing cryptographic functions, including md5 and >> hex functions, say in src/backend/utils/adt/crypt.c. > I had originally start

Re: SHA-2 functions

2018-02-20 Thread Peter Eisentraut
On 2/19/18 21:07, Michael Paquier wrote: > + sha224('abc') > + > \x23097d223405d8228642a477bda2​55b32aadbce4bda0b3f7e36c9da7 > Some bytea characters from the hash are not able to show up correctly? > This does not result in spaces. U+200B is a zero-width space, used here to hint for p

Re: SHA-2 functions

2018-02-19 Thread Michael Paquier
On Mon, Feb 19, 2018 at 08:43:44AM -0500, Peter Eisentraut wrote: > I also noticed while working on some SSL code that we have perfectly > good SHA-2 functionality in the server already, but it has no test > coverage outside the SCRAM tests. Yep, the refactoring in src/common/ has been done for SC

Re: SHA-2 functions

2018-02-19 Thread Michael Paquier
On Mon, Feb 19, 2018 at 03:02:02PM -0500, Peter Eisentraut wrote: > On 2/19/18 09:06, Aleksander Alekseev wrote: >>> So I suggest these patches that expose the new functions sha224(), >>> sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM >>> tests more robust, and it will allo

Re: SHA-2 functions

2018-02-19 Thread Peter Eisentraut
On 2/19/18 09:06, Aleksander Alekseev wrote: >> So I suggest these patches that expose the new functions sha224(), >> sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM >> tests more robust, and it will allow them to be used in general purpose >> contexts over md5(). > > Nice

Re: SHA-2 functions

2018-02-19 Thread Joe Conway
On 02/19/2018 08:43 AM, Peter Eisentraut wrote: > I also noticed while working on some SSL code that we have perfectly > good SHA-2 functionality in the server already, but it has no test > coverage outside the SCRAM tests. > > So I suggest these patches that expose the new functions sha224(), > s

Re: SHA-2 functions

2018-02-19 Thread Aleksander Alekseev
Hello Peter, > So I suggest these patches that expose the new functions sha224(), > sha256(), sha384(), sha512(). That allows us to make the SSL and SCRAM > tests more robust, and it will allow them to be used in general purpose > contexts over md5(). Nice patch. I wonder though whether tests sh