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 1tgaOt-00Bvy7-Sb for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Feb 2025 02:16:56 +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 1tgaOs-007JyS-K4 for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Feb 2025 02:16:54 +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 1tgaOr-007JyK-Vr for pgsql-hackers@lists.postgresql.org; Sat, 08 Feb 2025 02:16:54 +0000 Received: from mail-me3aus01olkn2082c.outbound.protection.outlook.com ([2a01:111:f403:2818::82c] helo=AUS01-ME3-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tgaOp-003s6d-2S for pgsql-hackers@postgresql.org; Sat, 08 Feb 2025 02:16:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RIZtlN+NrjI0b24se3Badaci/OrZEQuhhMffN/3lvGAnnVQwARgATnHf6ZpI9daBAVkV7a8sNW99/ft2Tsr1FT21XXXbbKAgaRlu2C96BocHTf+mBYQ0g7QMIzcFmvxfhUKjioJfweLCc0+Y0SMjUrx5DeRXbX69DBxY+uuhyYx3sGrL/ySZLkr8waDaaNTyjvKlf0+CR9t2GzWiIV1Gqr14l9v0updAKXwMgP6D+oN9xTkeLa6m5pSK2vEDQI1DtHRh1AoCY7yePLytshZPOnuaWfmujHpqGBGiR/OwKO11ebIizLHfSJsjx1M6LUKef/LX2wuTboB34+3GxUjCZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n7QUx9YJX+QlMnLNCyNK5tYeVFtIn34aZxdB97bqL74=; b=yfQW1yhV6WWktfshjsHpx4kv6J9ONGx6LLhJbdC26zuDAh8N+uMWiDaKJwT0wW03WqvV62Yaa3sVx9+WtHvnbqhj8iV3NYEOy1WdwJ6P/SWj6n9Nb1UeNsUWwweLqjSJDIYXRUurMPJBVKLy34QoIzSCzNGX33sESRzyUblP4KTi4xedV4gotyvTxfXUVKwy/L9gN/1UVjeUpbUluQMIj2R8u2xfOKgn37P33yYGDPVvF0vqahSPvPV7z3Bswq2a1tJJNeY3zye8wKCC9w5l8qYG8SiQBjDGziOcym2b44f2dBaPreywZn02rBUvnawVoKVFrbdbL8kYCwMQsLyj0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n7QUx9YJX+QlMnLNCyNK5tYeVFtIn34aZxdB97bqL74=; b=M2twYu7/IEyvmXF9P37KerBAjRQ7WGOlQw/RCIfJTmZ7XtA0eKapcL3UfN89g7e51imYaUDi/YmatHa1xQOoFbvgk56klHJRTkxi611IlKxBFXRS3nJ8XcwWk6PLw1EDdNlCw/PIdx3ddrnzd0MHxl99UIgiVZatRVbncEVzD/5tD/bBbuVkkxLbw+g7g4kNydDK4oERH9RxlmTySdrD5FfoeEtEdOf4JULcjg4pujqWmBmOs+8JVKcMQaxwnWVQAREflh//Uz9FGl9CRNAVMXs7caMULCl9vKHyNuMooJK8xHpMfUL/8ke2GQeK8F5hL/jIEiZbjhJ/VfmSbh9yqQ== Received: from ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM (2603:10c6:220:229::19) by SY0P300MB0641.AUSP300.PROD.OUTLOOK.COM (2603:10c6:10:285::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.15; Sat, 8 Feb 2025 02:16:45 +0000 Received: from ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM ([fe80::3fa7:f775:d5cc:ff66]) by ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM ([fe80::3fa7:f775:d5cc:ff66%5]) with mapi id 15.20.8422.012; Sat, 8 Feb 2025 02:16:45 +0000 From: Japin Li To: Alvaro Herrera Cc: Bernd Helmle , PostgreSQL Development Subject: Re: Modern SHA2- based password hashes for pgcrypto In-Reply-To: <202502070931.7mcjufnk5g5l@alvherre.pgsql> (Alvaro Herrera's message of "Fri, 7 Feb 2025 10:31:44 +0100") References: <202502070931.7mcjufnk5g5l@alvherre.pgsql> Date: Sat, 08 Feb 2025 10:16:40 +0800 Message-ID: Content-Type: text/plain X-ClientProxiedBy: TY2PR02CA0048.apcprd02.prod.outlook.com (2603:1096:404:a6::36) To ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM (2603:10c6:220:229::19) X-Microsoft-Original-Message-ID: <87pljtmb93.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ME0P300MB0445:EE_|SY0P300MB0641:EE_ X-MS-Office365-Filtering-Correlation-Id: 77525d62-873f-4ce6-522b-08dd47e6a231 X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|461199028|7092599003|5072599009|19110799003|8060799006|440099028|3412199025|19061999003|21061999003|12071999003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?A5bdMyT2ot+C71dC4udctbGdK50kVT4x63uCH7P2X+9E1Na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TsgFu4pKr9NviKQmWiy9/w3vzIpQSlDI5FTz14guhk+9s?= =?us-ascii?Q?Rkc0uR+sgmrNmv1tIl9YMyhZtNXXwZ3J1FiKPQQhW/foA02TOBpr6f5EKPLo?= =?us-ascii?Q?NLxezsH6kIaGylapOrQmtu9g3Q44PxvGMYKlCqY5XK5u8g5pYNQs8sJJqdhh?= =?us-ascii?Q?5+R3jnzapcGRKKye+cS/5z1wiR6LrYFiY/QyMFSOgsEIOr8lIWESWHdgo9K7?= =?us-ascii?Q?hJoG5H0G3Hhn8VJ016x72zGiUO3VpOTimSlUbhLASHk4U9A04qU8jP8=3D?= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0Gtl5IPgi5Ra94p7/iWVruGRciPQHJBlE0bvUr1+5rr8jcPr8a4XMFQMx9r5?= =?us-ascii?Q?qQAaVy03KuiiFxK6neWuBru+rj+VEGm53L6pdThvQzFLWg9zhfY+QtETgWLZ?= =?us-ascii?Q?Adz3Ti/KduLPbezrV3Yeq09ZP6snLMTQzGIH0I5mJv99Z04AlBhweL6C5icj?= =?us-ascii?Q?Eyo4YQZKVVFt3SuVCCfNC5jbn56qpUecDRBm7Nyd3k1I2h7i/F15tMjqIVR5?= =?us-ascii?Q?giC19GG39AHAotEgsh68BUWaQOKauZCXZ460dL/X29uW3z4WLt995eiwPRp7?= =?us-ascii?Q?fIZuSccwa/8/yaQBAInpS1nHSyjNxyWzQgmO8a9xgXKbcTleJqqJ6hxwXb/Z?= =?us-ascii?Q?fQPaLB0rDTHkqCVnTCC6hk0kQbRAF0NEiqvq66WwT+4M6GPby19uJHEerQuq?= =?us-ascii?Q?pMOvyuEpXx9eA2tHwqCbiQ5di25axcBH1U43d+DAgNjH2pcgAVK0KlvKY/g1?= =?us-ascii?Q?BPQ3oDMrX0PdKgp7p+owNKelavt8/7cYu46sw/NyP1Fq6DGKiZ8bSIF2YWY2?= =?us-ascii?Q?GC50Cm4RWqlZkfB43Dr9cWjKXftlrjBO2pLdl1PGDXLjbVPcRUCr0Ast12/J?= =?us-ascii?Q?hEwK/tRzZm/11ItwedDOhJHV66e2XHWE9tGfB4ILBgN3/Zte/P7Jw4zTjHeO?= =?us-ascii?Q?2jF3StPJ8kt7YY5f0TqZwyN0XjZAqe8m6GsExPQXhMbnnAnmTT7OpWBWamoR?= =?us-ascii?Q?XJyIkglsZRI+Kq56wi6Qw5pcQUYXvQGidj2dNrW9X2kfU41jdMOeUf++gOAm?= =?us-ascii?Q?ayGeXbz7NQZRicPCmQqcmp4wWc2PAcA88EItLE40Xu8WUlqnf1i0ItvuNT4K?= =?us-ascii?Q?uBEvbKa56YCUMEL2IHhz3h6YUN09qLfTIiiAKOow38oYalFP3tb6Ze1hGelD?= =?us-ascii?Q?fiqaUoB+AImPFIJgMeV4VtfpOQRnZfaZG52YOwIiTmlu6Hc/dtYuuYCO7HBd?= =?us-ascii?Q?YIOdj92VI5w4pEhfmx2dkgrqMK9pQCPFdA+C2kurx9RFg241ybtAPwFJjMN8?= =?us-ascii?Q?JLKiUA9RtPddDUS4rAq16WSqPKP5S0xp+PlvqWxfWYnV45+1IYSrtkX7udht?= =?us-ascii?Q?ocjHX9MM8USUPkhOCHghCazose37a0wKC94XxvH4XXiABQuoqrt8WqUd5CD+?= =?us-ascii?Q?f58BcKIDrE3EtAVSNGrtKcHeyHDg/YsyvAvDfhDVZYXeY6TRpKoj/4A3VJWf?= =?us-ascii?Q?jqn3dRma9isfNB0+2RE5dcRAONc52+uAVcgFyHkL/7QDE4ANG+iKyxF7qaU?= =?us-ascii?Q?=3D?= X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-448bf.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 77525d62-873f-4ce6-522b-08dd47e6a231 X-MS-Exchange-CrossTenant-AuthSource: ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2025 02:16:44.8823 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SY0P300MB0641 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 07 Feb 2025 at 10:31, Alvaro Herrera wrote: > On 2025-Feb-07, Japin Li wrote: > >> Since there is no standard, how do we handle this? I prefer to use >> the strict mode like passlib. > > I definitely like that passlib have documented their thought process > thoroughly. > > I think using their strict mode is good on principle, but if we're going > to do that, then the salt string should not be used verbatim, but > instead base64-decoded first to get the actual salt bytes, like they do. > Does this break compabitibility with other systems? Are > passlib-generated password hashes incompatible with, say, "openssl > passwd" which you (Bernd) mentioned at the beginning of the thread? > Maybe if the password hashes are no longer compatible, then we should > ditch the idea of restricting salts to base64 chars and accept the whole > range of bytes, like Drepper. Thinking about compatibility, the Drepper's behavior is a good choice. Or we can accept the whole range of bytes except the $ character since it is a separator. Of course, it is also not compatible with other systems. > > But in any case ISTM we should reject, as they suggest, the use of less > than 4 bytes of salt (and should perhaps settle for a default of 16, as > passlib suggests). I suppose this is why passlib returns NULL with > empty salt. What we should do in that case IMO is ereport(ERROR). +1 -- Regrads, Japin Li