Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfyzu-006jc5-H1 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Feb 2025 10:20:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tfyzt-0060Bm-DN for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Feb 2025 10:20:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfyzt-0060Bd-20 for pgsql-hackers@lists.postgresql.org; Thu, 06 Feb 2025 10:20:37 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tfyzq-003VPy-2d for pgsql-hackers@postgresql.org; Thu, 06 Feb 2025 10:20:36 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2D1CF254013A; Thu, 6 Feb 2025 05:20:34 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 06 Feb 2025 05:20:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1738837234; x=1738923634; bh=W 3kzCy5knP5YaBjFmmMCi5KOrJBc0o4PrhLbc0Ly5vo=; b=jbmMxXCvqR/0yuGDw jvei8YLzJtyWJoD7lSQBSK+ZyqB4E3Sid0vGsMJRaLvOGJmQQWl/JOtQhmQ+XdUe jkgAfIrXehUIqzaSABK4LWqZv//GhGPS4cpTYbYmTJoqj6w71tHlSufeOp4XNfKf f5zQcAH40Wn5ZWcxcv0pksCyS4zCN9FcQZSOAz95k0YPYAUui4LSl7656c+9GdwO P0h0eCXQXY3npOE6WWfGkm6HP+rYdzcKZEcus+9iYm0hwJATnsQbCMJOMcXV70MF K/pvwWm5RD9I3ylUumqc9gDqisLNtIPEMw/k7IaI67D5qf1PwVZMY3wZvQcIC1th 9kgAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpefftdeugfevheffvddtfefg jedukeevhfdvieettdetgfetfeegteeiveeffeehveenucffohhmrghinheprhgvrgguth hhvgguohgtshdrihhopdhgihhthhhusgdrtghomhdpphhhtgdqshhfqdhsphgvtgdrmhgu pdgvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdho rhhgpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope hjrghpihhnlhhisehhohhtmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrihhlihhnghhs sehoohhpshifrghrvgdruggvpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesph hoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Feb 2025 05:20:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1738837231; bh=unGxbul5IU+kRYe+rhrkZp3tTAXqX4YGxRn9A1U8YGk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=NAOU5+3yLEseWek0+Znnk49G/h7QJVRPNA7CJJepK24m8+8jhUC6oyJkk0Lpx4Gt+ AvugUyu0IO7MtWtmb4c8QeaXd40+e1mlCIHqkAA3dP+br3/ZNCE876wSBaBQhA8Q2X NetTtIjhjWKPqG/qCgBg4CtK2pzd5ceek9jbniboG4AtGrE+89V5p7cpZJGtuc25fs gtYPuL/3p231U9PljuJsxt5k2AGSI52LDkZW2idVpmgUq2PIn9KGY0VCkI+bHvXBFe xCp2pLe61sL9XNumSLPMv0Ym0XFKdAng95pfGKpVPD5fEno8Bk6spB2++JkH4a23Ve TkuFKivT99uIA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id D6E8290; Thu, 6 Feb 2025 11:20:31 +0100 (CET) Date: Thu, 6 Feb 2025 11:20:31 +0100 From: Alvaro Herrera To: Bernd Helmle Cc: Japin Li , PostgreSQL Development Subject: Re: Modern SHA2- based password hashes for pgcrypto Message-ID: <202502061020.364t2wmbnuus@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0ea9c29350e76987e7564fac5662e8a5741ddfbf.camel@oopsware.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Jan-28, Bernd Helmle wrote: > Python's passlib is very strict when it comes to supported characters > within a salt string. It rejects everything thats not matching '[./0- > 9A-Za-z]'. So when you provide the example above you get The reason it uses these chars is that in their scheme the salt bytes are base64-encoded. The passlib docs has this page about the "modular crypt format": https://passlib.readthedocs.io/en/stable/modular_crypt_format.html and they point this other page as a "modern, non-ambiguous standard": https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md About the salt, this last document says: The role of salts is to achieve uniqueness. A random salt is fine for that as long as its length is sufficient; a 16-byte salt would work well (by definition, UUID are very good salts, and they encode over exactly 16 bytes). 16 bytes encode as 22 characters in B64. Functions should disallow salt values that are too small for security (4 bytes should be viewed as an absolute minimum). This "Password Hashing Competition" organization hardly seems an authority though. It'd be great to have an IETF standard about this ... -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/