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 1iuKrD-0002vD-Fi for pgsql-general@arkaria.postgresql.org; Wed, 22 Jan 2020 18:36:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iuKrB-0003MI-EC for pgsql-general@arkaria.postgresql.org; Wed, 22 Jan 2020 18:36:01 +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 1iuKr9-0003MB-Ky for pgsql-general@lists.postgresql.org; Wed, 22 Jan 2020 18:36:01 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iuKr5-0001bx-1d for pgsql-general@lists.postgresql.org; Wed, 22 Jan 2020 18:35:59 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 3D1CD4C6; Wed, 22 Jan 2020 13:35:51 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 22 Jan 2020 13:35:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=q NdvXZmnBKV3Hu/wS4ST1QgHlTSToPd+UsAbFd7PT1c=; b=aCOQq9YYfSQ9Q2uI7 yXUz+YgU1qVFGPODmOiXNlXc4uKS1YYKILBWp9tHjVXpsKOCErKc7zIe9kMtbkt1 jtyt+eqZ/xG9Lmli58sYdrZS/2Tsfu+GffDDHPTfRnW2/81z5G4cRyjqonhoSiZb Crq3ZEOZZfGo/6/ydUcZjafmtvW6nmrZNFypoLOWiz4EwVvcvAcOUHEl0oJcEiqe TmwTFtbEwzagFdnVaFrkaj1/I+20A6iAqUXBiQeLMasafWoxCIRPkMJgukRtCFfq +j0U7ZtJSI+V/vHkL191VpMOO1s9KmNCtvyeDM+iANddU6oMtOS3Rb5PoJ+jXhQm 2XpYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=qNdvXZmnBKV3Hu/wS4ST1QgHlTSToPd+UsAbFd7PT 1c=; b=QyebLbgMSgqgW9TmPo4GCM1CeyitsYKJouqAj79Pg+cntYMSHO9VXMo1W nUVUfhHJDnNU13YAkO0GG7vNcC/ZL9LfGnGEuMSiHRMSnjk/k+aEX8urHVWN/OBV yK9Y/PggEVYgtHBtPTw81akExoGD0HBemZNtpzECGeeqznvzZi7bF2afJKuPKtpo jEYxC3U9pyfZhlfXzoxURWs79/DwpPM1k/RKsoEGAqNSomidbK58s372Y4jdacFb dx1YIcX7zL5FVx8z2tQ4j6C+Kv+mh+bLWSx6sEXhNAWagkHEGjUPM4lZgEeb0O2t S/NfwZaas5oyIsBP3SHHiZTeVLvSQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrvddtgddutdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucfkphephedtrdduleefrdduleeirddutdeinecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from ranger.suse (50-193-196-106-static.hfc.comcastbusiness.net [50.193.196.106]) by mail.messagingengine.com (Postfix) with ESMTPA id 1A9BD3280059; Wed, 22 Jan 2020 13:35:50 -0500 (EST) Subject: Re: calculating the MD5 hash of role passwords in C To: Matthias Apitz , pgsql-general@lists.postgresql.org References: <20200122182036.GA2908@c720-r342378> From: Adrian Klaver Message-ID: Date: Wed, 22 Jan 2020 10:35:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200122182036.GA2908@c720-r342378> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/22/20 10:20 AM, Matthias Apitz wrote: > > Hello, > > If I look into the database I see: > > 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? https://www.postgresql.org/docs/12/runtime-config-connection.html "Because md5 uses the user name as salt on both the client and server, md5 cannot be used with db_user_namespace." ~/src/common/md5.c /* * Place salt at the end because it may be known by users trying to crack * the MD5 output. */ So: select md5('sisis123sisis'); md5 ---------------------------------- 2f128a1fbbecc4b16462e8fc8dda5cd5 > > Thanks > > matthias > -- Adrian Klaver adrian.klaver@aklaver.com