Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60989 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94013 invoked from network); 27 Jun 2012 11:51:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2012 11:51:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qa0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:41634] helo=mail-qa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/15-02132-CC3FAEF4 for ; Wed, 27 Jun 2012 07:51:41 -0400 Received: by qafi31 with SMTP id i31so2720623qaf.8 for ; Wed, 27 Jun 2012 04:51:38 -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:content-transfer-encoding; bh=Alh/eg+xQt51QJKhyJ96gLEE8JfuBnNyrXH2GyNcCWg=; b=ukIC9d0mhIor+3GrDkSxM5iLji9bXwqiV3cEttPpqYPYVUuWUugJQI6yQG/qd3sDRp toO+qYE0EOeDyqX5jkMyDVQ1aB1TjPfJUIpP5Eke55lTNC1a0C5MlSSQ1MSUq5eUrRoV oyTv8i3tObwxfHDkBAKJL3Ur+TIEeaS2UEZTOHBpHT/Gu4R2xZJb3atnFq5FI+tfFc9l 0RqQFKONV689df8zrNGbcVWQzWgMSR3T+0J4yKeCgitWjz9A0TZJsRoSSz5pNT9Qkrh4 ChRkKp+bXr7KpySm9TJ/yXCFjMiNlDskLxAb7G3i6UpH6yfgHxSlEJ7EuD1LKyOBzbRs Q3jQ== MIME-Version: 1.0 Received: by 10.229.135.130 with SMTP id n2mr8618227qct.85.1340797898354; Wed, 27 Jun 2012 04:51:38 -0700 (PDT) Received: by 10.229.232.11 with HTTP; Wed, 27 Jun 2012 04:51:38 -0700 (PDT) In-Reply-To: <20120627092217.GA16399@openwall.com> References: <20120627092217.GA16399@openwall.com> Date: Wed, 27 Jun 2012 07:51:38 -0400 Message-ID: To: Solar Designer Cc: Pierre Joye , Herman Radtke , Nikita Popov , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Adding a simple API for secure password hashing? From: ircmaxell@gmail.com (Anthony Ferrara) Alex, > Thank you for the chance to comment, and sorry that I did not do so yet. > I am busy with lots of other stuff. =A0I'd appreciate it if you don't > hurry to implement this stuff too much, and I likely will comment on it > (that is, on the actual proposed API and implementation). =A0Please keep > me in the loop. It's not a huge rush, but at the same time I'd like to get it in by 5.5. The RFC process takes at minimum 3 weeks from official proposal (2 week discussion + 1 week voting). And I haven't officially proposed it yet. So there's still some time. > Note: _if_ you ask for a portable hash. =A0What else should it do if you > ask it for just that? That's a fair point. I guess since the adoption of 5.3, and the fact that 5.2 is dead (yet alone php4), has me thinking that "portable" means something different today than it did then... >> > So for modern versions >> > of PHP (5.3+), it produces an unnecessarily weak hash. > > For modern versions of PHP, if you don't require portability of hashes > to older versions, don't ask it for a portable hash. That's fair. Perhaps the documentation needs updating to indicate that *portable* really just means compatibility with php <=3D 5.2... > Of course, new PHP apps that will depend on your new API won't run on > older versions of PHP by definition, so they could assume bcrypt is > available. =A0A concern, though, is that by the time major web apps would > be able to assume a recent enough version of PHP (with this new API) > we'll prefer to use a password hashing method with more than one > configurable parameter (not just one "cost" setting), so we may want to > design the API with that in mind. That's a very good point. And it's already designed into the API. Right now, it only implements one algorithm in the core, but the switches and options are all there to support multiple. I just didn't see any solid reason to include the other (slightly less favored) crypt() hashes available today (SHA512 for example). But it's designed so that they can be added easily. I know there's talk floating around the list with respect to adding scrypt support into core. If that happens, it would definitely be added to the implementation. > Additionally, I was/am going to experiment with implementing a decent > KDF in PHP, but also considering its native reimplementation at the same > time (for inclusion in PHP proper, etc.) =A0That way, we could have hashe= s > that are both portable (to older versions of PHP, to other scripting > languages, etc.) and efficient. =A0My expectation is that when implemente= d > in a scripting language (using a widely-available crypto primitive like > SHA-512 or AES), they could be somewhere inbetween bcrypt and scrypt in > terms of cost of attack - and when reimplemented natively, they could be > approaching scrypt (although Colin's choice of Salsa20/8 core for the > crypto primitive was not arbitrary, and unfortunately we don't have that > in PHP). =A0I feel that there's room for exactly one such would-be > de-facto standard "scripting KDF", and I might be in a position to set > this standard due to phpass (this new thing could be a next generation > phpass). =A0But I haven't decided on this yet, I'd need to experiment > first, and I don't like to be rushed. ;-) No rush at all. I like the concept though. Would it be worth while to add an implementation of salsa20/8 to the core? > http://www.openwall.com/presentations/PHDays2012-Password-Security/mgp000= 51.html > > I think it's OK/preferable not to introduce this new hash type earlier > than in a year from now or so, unless there's imminent threat of someone > else doing it substantially worse. ;-) =A0Meanwhile, I don't mind having > an API that would provide bcrypt, even though I think that phpass does > this well enough (and I intend to release a minor update to this first > generation phpass). =A0As long as we're not introducing a new hash type t= o > this world yet, we are OK to experiment with APIs, etc. Well, part of the reason for this API, is that it appears that the majority of developers either aren't willing to use a library, or don't know it exists (even though it's very easy to find if you try). Additionally, I would think there would need to be a vetting period for a new KDF like this (for review, and trial implementations and such) before it would be considered "stronger" than bcrypt. If that's the case, then the core implementation would work fine. You implement the new KDF in a library. It goes through vetting and testing. if all is good, when it's mature it can be added back into core in this API. Thanks, Anthony