Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60828 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90522 invoked from network); 14 Jun 2012 14:26:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2012 14:26:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=peter.e.lind@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=peter.e.lind@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: peter.e.lind@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gg0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:59076] helo=mail-gg0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/E7-39100-694F9DF4 for ; Thu, 14 Jun 2012 10:26:31 -0400 Received: by ggnf2 with SMTP id f2so1588445ggn.29 for ; Thu, 14 Jun 2012 07:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=8m8hCGbci8Q+SFF/uN0nvJ7tHTVVO0iG+19dd2AG1jc=; b=kB7UjaZwnjSNVKOLGxIKL/zNRX5XiZJds4W65dKF8wx5Z/1xSgVSV4/LqveZKFvByf xU/PGwMkDSgalkCTaL3VQJsNOMWwTsjnCLdKkjwvT2zeZmNqAnnH2WsauqGTy3DTAfsV iq15x4BqaOq7L5SqkC9SyqTuEzC0YToJjsU3wDc8rnqmvoQCKRaX5v52Yqznkw1gaBPl oMLdbWhAFy1RX5bzgN/579uQLkEuCgjCb8JiUVD8EHAojHgZtg8ztEu/75qEd++MMHLd S7Ql5/I2vXVMq2M3Pr+PsJf1+7PmyeERabPNxz1RRWHp/So1lD26utNxrIJ0UAGo8ypj irJQ== Received: by 10.60.30.101 with SMTP id r5mr1987715oeh.68.1339683987730; Thu, 14 Jun 2012 07:26:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.27.169 with HTTP; Thu, 14 Jun 2012 07:26:07 -0700 (PDT) In-Reply-To: References: Date: Thu, 14 Jun 2012 16:26:07 +0200 Message-ID: To: Anthony Ferrara Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Adding a simple API for secure password hashing? From: peter.e.lind@gmail.com (Peter Lind) On 14 June 2012 15:35, Anthony Ferrara wrote: > Peter, > >> Whether or not a CSPRNG is needed depends on what you're doing, your >> needed level of security. Perhaps add a parameter to control this, so >> it would be possible to make use of this function even if you need the >> maximum level of security? If it's not available, the function should >> fail in some suitable fashion. > > For password hashing, it won't ever be needed for the salt. The salt > is not a secret in the context of cryptography. But, on that note, if > we were adding a stronger PRNG generator, it would be good to expose > it natively. And that native exposure would likely take a parameter > for CS-safe PRNG... I would say it really depends upon the project. The salt can not only protect against rainbow tables and password hash collisions, if it is unknown to an attacker then it essentially acts to further strengthen the hash by vastly expanding the keyspace. Supposing an attacker is trying to get at the password for just one user account (say, admin) and the hashed password is available - if the salt can be predicted/guessed, then the keyspace is reduced to that of an unsalted password and you can run a dictionary attack on the hash. If, on the other hand, the salt is unpredictable and you don't have access to it, there is no way to run a dictionary attack (offline, that is). The security here depends upon storage as well, but the point remains - a salt isn't by default something you can make public knowledge. It might be a theoretical concern for most people and the people really wanting the extra level of security would probably know well enough how to get exactly what they need - but if provisions are made so you could reuse the same function you might also be able to educate developers better. I.e. make it easy to do the right thing and more people will do it. Regards Peter -- WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15