X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 983E1D79ED for ; Wed, 2 Nov 2005 14:57:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82189-04 for ; Wed, 2 Nov 2005 18:57:20 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id F2747D688B for ; Wed, 2 Nov 2005 14:57:19 -0400 (AST) Received: (qmail 11250 invoked by uid 500); 2 Nov 2005 18:59:30 -0000 Date: Wed, 2 Nov 2005 12:59:30 -0600 From: Bruno Wolff III To: "Mark R. Dingee" Cc: pgsql-sql@postgresql.org Subject: Re: PGSQL encryption functions Message-ID: <20051102185930.GA10108@wolff.to> Mail-Followup-To: Bruno Wolff III , "Mark R. Dingee" , pgsql-sql@postgresql.org References: <200511011438.06610.mark.dingee@cox.net> <20051101212844.GA24861@wolff.to> <200511011700.50776.mark.dingee@cox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200511011700.50776.mark.dingee@cox.net> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/30 X-Sequence-Number: 23282 On Tue, Nov 01, 2005 at 17:00:50 -0500, "Mark R. Dingee" wrote: > Bruno, > > I use an authenticate() function as a part of state maintenance in a PHP web > app. In the function, I generate an encrypted token that is then used in the > validation process on subsequent pages. md5 works, but I've been able to > brute-force crack it very quickly, so I'm looking for an alternative. Any > thoughts would be greatly appreciated. This isn't a problem with MD5. While MD5 does have some theoretical weaknesses, they aren't really an issue in this case. Why are you using a hash at all? If you are using the hash as a key, why not just use a random string instead? The web browser could be handed a session id and random string and on the server you would have a table indexed by session ids that includes the random string. On many systems you can use /dev/urandom as a source of random data. Since you don't seem to be concerned about sniffing, /dev/random is probably overkill and having it block when low on entropy would probably be a problem for you.