Re: Add SQL function for SHA1

From: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add SQL function for SHA1
Date: 2021-01-26 03:42:25
Message-ID: CAH7T-aod_q65EBR=eL1BFog==4wsHw0cEh5-_F6UCpNFsvzFpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
cryptohash-refactor-and-add-sha1.diff application/x-patch 5.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message japin 2021-01-26 03:47:52 Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax
Previous Message Tom Lane 2021-01-26 03:33:19 Re: patch: reduce overhead of execution of CALL statement in no atomic mode from PL/pgSQL