Re: Add SQL function for SHA1 - Mailing list pgsql-hackers

From Sehrope Sarkuni
Subject Re: Add SQL function for SHA1
Date
Msg-id CAH7T-aod_q65EBR=eL1BFog==4wsHw0cEh5-_F6UCpNFsvzFpA@mail.gmail.com
Whole thread Raw
In response to Add SQL function for SHA1  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Add SQL function for SHA1  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
+1 to adding a SHA1 SQL function. Even if it's deprecated, there's plenty of historical usage that I can see it being useful. 

Either way, the rest of the refactor can be improved a bit to perform a single palloc() and remove the memcpy(). Attached is a diff for cryptohashfuncs.c that does that by writing the digest final directly to the result. It also removes the digest length arg and determines it in the switch block. There's only one correct digest length for each type so there's no reason to give callers the option to give the wrong one.

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch: reduce overhead of execution of CALL statement in no atomic mode from PL/pgSQL
Next
From: japin
Date:
Subject: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax