Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iuf8z-0003p1-5I for pgsql-general@arkaria.postgresql.org; Thu, 23 Jan 2020 16:15:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iuf8x-0001dZ-Tr for pgsql-general@arkaria.postgresql.org; Thu, 23 Jan 2020 16:15:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iuf8x-0001dS-Gp for pgsql-general@lists.postgresql.org; Thu, 23 Jan 2020 16:15:43 +0000 Received: from smtp.burggraben.net ([88.198.69.140]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iuf8u-0004DS-LM for pgsql-general@lists.postgresql.org; Thu, 23 Jan 2020 16:15:42 +0000 Received: from squirrel.exwg.net (unknown [141.113.66.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "squirrel.exwg.net", Issuer "Christoph Moench-Tegeder" (verified OK)) by smtp.burggraben.net (Postfix) with ESMTPS id 19A2CC00313; Thu, 23 Jan 2020 17:15:38 +0100 (CET) Received: by squirrel.exwg.net (Postfix, from userid 1000) id 80945505B76; Thu, 23 Jan 2020 17:15:37 +0100 (CET) Date: Thu, 23 Jan 2020 17:15:37 +0100 From: Christoph Moench-Tegeder To: Matthias Apitz Cc: pgsql-general@lists.postgresql.org Subject: Re: calculating the MD5 hash of role passwords in C Message-ID: <20200123161537.GA31330@squirrel.exwg.net> References: <20200122182036.GA2908@c720-r342378> <20200122185847.GA90048@elch.exwg.net> <20200122194113.GA2410@c720-r342378> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200122194113.GA2410@c720-r342378> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## Matthias Apitz (guru@unixarea.de): > > The documentation on pg_authid has the details: > > "The MD5 hash will be of the user's password concatenated to their user name." > > https://www.postgresql.org/docs/12/catalog-pg-authid.html > > This is still not exactly what I was looking for. But has an interesting > detail (salting the role password by adding the role name to it). An > implementation with UNIX crypt(3) for MD5 would need an additional salt > like '$1$salt' to encrypt 'sisis123sisis'. It's not crypt(3). It's "the MD5 hash of the user's password concatenated to their user name". Try: perl -MDigest::MD5 -e 'print("md5" . Digest::MD5::md5_hex("sisis123" . "sisis") . "\n");' Regards, Christoph -- Spare Space.