Modern SHA2- based password hashes for pgcrypto
Bernd Helmle <mailings@oopsware.de>
From: Bernd Helmle <mailings@oopsware.de>
To: PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2024-12-31T16:06:35Z
Lists: pgsql-hackers
Attachments
- 0001-Add-modern-SHA-2-based-password-hashes-to-pgcrypto.patch (text/x-patch) patch 0001
Hi Hackers, Some of you might already arrived 2025, so first a Happy New Year to everyone already there ;) Please find attached a patch to pgcrypto to add modern SHA-2 based password hashes sha256crypt (256 bit) and sha512crypt (512 bit) for crypt() and gen_salt() respectively. This is compatible on what crypt() currently does on FreeBSD and Linux and both algorithms are considered more secure than the currently implemented hashes. I adapted the code from the publicly available reference implementation at [1]. It's based on our existing OpenSSL infrastructure in pgcrypto and produces compatible password hashes with crypt() and "openssl passwd" with "-5" and "-6" switches. I documented the new supported hashes for pgcrypto, but didn't do anything to update the benchmark table for the supported password hashes. Modern OS (at least Linux, BSDs) implementations for crypt() also support yescrypt, which is the recommended (and default) password hash algorithm there. I am also looking to implement that, but thought it would be useful to have the SHA-2 based hashes first in the review. I am going to add this patch to the upcoming january commitfest for initial review. [1] https://www.akkadia.org/drepper/SHA-crypt.txt -- Thanks, Bernd
Commits
-
Follow-up fixes for SHA-2 patch (commit 749a9e20c).
- 969ab9d4f5d1 18.0 landed
-
Add modern SHA-2 based password hashes to pgcrypto.
- 749a9e20c979 18.0 landed