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 1iuLDK-0003z5-N3 for pgsql-general@arkaria.postgresql.org; Wed, 22 Jan 2020 18:58:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iuLDJ-0000bZ-BB for pgsql-general@arkaria.postgresql.org; Wed, 22 Jan 2020 18:58:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iuLDJ-0000bR-1U for pgsql-general@lists.postgresql.org; Wed, 22 Jan 2020 18:58:53 +0000 Received: from smtp.burggraben.net ([88.198.69.140]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iuLDE-0001tY-WF for pgsql-general@lists.postgresql.org; Wed, 22 Jan 2020 18:58:52 +0000 Received: from elch.exwg.net (elch.exwg.net [IPv6:2001:470:7120:1:127b:44ff:fe4f:148d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "elch.exwg.net", Issuer "Christoph Moench-Tegeder" (not verified)) by smtp.burggraben.net (Postfix) with ESMTPS id D6658C00312; Wed, 22 Jan 2020 19:58:47 +0100 (CET) Received: by elch.exwg.net (Postfix, from userid 1000) id 82DBB139892; Wed, 22 Jan 2020 19:58:47 +0100 (CET) Date: Wed, 22 Jan 2020 19:58:47 +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: <20200122185847.GA90048@elch.exwg.net> References: <20200122182036.GA2908@c720-r342378> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200122182036.GA2908@c720-r342378> User-Agent: Mutt/1.13.3 (2020-01-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## Matthias Apitz (guru@unixarea.de): > sisis71=# select rolname, rolpassword from pg_authid where rolname = 'sisis'; > rolname | rolpassword > ---------+------------------------------------- > sisis | md52f128a1fbbecc4b16462e8fc8dda5cd5 > > I know the clear text password of the role, it is simple 'sisis123', how > could I calculate the above MD5 hash from the clear text password, for > example in C? Which salt is used for the crypt(3) function? 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 Regards, Christoph -- Spare Space