Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49062 invoked from network); 31 Jul 2012 12:23:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2012 12:23:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gh0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:39552] helo=mail-gh0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/1B-00342-A4EC7105 for ; Tue, 31 Jul 2012 08:23:38 -0400 Received: by ghbg2 with SMTP id g2so6776142ghb.29 for ; Tue, 31 Jul 2012 05:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=X4GOVOXch1ELUEUM4EGhNuGORYAxo0AJeGHxjQHBmE4=; b=NabZiuZ83Fd79LqClWetsfQlvdewEUz+mMVGE5I2dQlWJZE3kWSebcw4xLZaHRIy4C TmPdPV3iXMfz79gCoHoupJvYd300VpQr2EbevbxehK6ppDXRlze8eBFmCKMqrNOKzMqy 1RFs48eeuG5ljQ2K0m4aI7Gi7jT2jFvDqrDMgWRL1+ht87bs9S9GXo4hcWQWMGjhLTIC QN8bfLz+DWDwgvxQ64gpelOIgaD8NqD5HRt1MN9g6M8o6hRQXj3KxJw1A0wucVHvT/sV v/xAs36ifG6Gis8CToZo4ZnXp0Q42nXDuhdZW4IH0k9wrvU5VqvJKnhMzk+uXvD1rMiz 5I/Q== MIME-Version: 1.0 Received: by 10.50.196.201 with SMTP id io9mr1685052igc.58.1343737415314; Tue, 31 Jul 2012 05:23:35 -0700 (PDT) Received: by 10.64.32.1 with HTTP; Tue, 31 Jul 2012 05:23:35 -0700 (PDT) In-Reply-To: <004a01cd6f14$62247d40$266d77c0$@com> References: <004a01cd6f14$62247d40$266d77c0$@com> Date: Tue, 31 Jul 2012 14:23:35 +0200 Message-ID: To: Jonathan Bond-Caron Cc: Arvids Godjuks , Anthony Ferrara , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [DRAFT RFC] Adding Simplified Password Hashing API From: pierre.php@gmail.com (Pierre Joye) hi, On Tue, Jul 31, 2012 at 2:02 PM, Jonathan Bond-Caron wrote: > On Wed Jun 27 12:32 PM, Arvids Godjuks wrote: > a) In terms of 'effort' to break many passwords, there's a benefit to the salt stored in the hash itself. > It's not 'more secure' but 'better/recommended' since the attacker would need to create a 'rainbow table' for each password it's trying to crack > Overall, the technique offers better protection. > > b) In terms of 'effort' to break a single password, there's **no** benefit to the salt stored in the hash itself. > > If you want a single password to be really secure, don't let the attacker know the salt and keep it long: > > // no benefit of short salt, ~ same effort required by the attacker > $password = '234'; > md5($password); > > $salt = '1'; > $password = '234'; > md5($salt . $password); > > c) The best of both worlds: long private salt (b) + different for every user (a) > $saltInpassword = $password[0]; // could be random bytes, stored in password like crypt() does > $salt = 'my-long-private-value-use-all-bytes'. $saltInPassword; > $password = '234'; > $hash = md5($salt . $password); > > This one requires more effort by the attacker since the long salt forces more 'bits/guesses' to pass into md5() > > // require even more effort, iterate > for($i = 0; $i < 1000; $i++) > $hash = md5($i . $hash); This is somehow the 1st implementation (part of) of crypt. See ext/standard for the full code. And md5 is now known to do not be secure enough. IIRC. I would not, but really totally not, begin to try to implement our own little algorithm but rely on standard well tested implementations. Crypt support blowfish, for example. Anthony also works on supporting more algos afair. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org