Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94885 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14647 invoked from network); 6 Aug 2016 16:37:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2016 16:37:42 -0000 Authentication-Results: pb1.pair.com header.from=lauri.kentta@gmail.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=lauri.kentta@gmail.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain gmail.com does not designate 188.117.41.47 as permitted sender) X-PHP-List-Original-Sender: lauri.kentta@gmail.com X-Host-Fingerprint: 188.117.41.47 mailgateway.locotech.fi Linux 2.6 Received: from [188.117.41.47] ([188.117.41.47:46151] helo=mailgateway.locotech.fi) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/5A-33134-35216A75 for ; Sat, 06 Aug 2016 12:37:40 -0400 Received: from localhost (mailgateway [127.0.0.1]) by mailgateway.locotech.fi (Postfix) with ESMTP id AFE06A360FA; Sat, 6 Aug 2016 19:37:36 +0300 (EEST) X-Virus-Scanned: amavisd-new at locotech.fi X-Spam-Flag: NO X-Spam-Score: -1.998 X-Spam-Level: X-Spam-Status: No, score=-1.998 tagged_above=-9998 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9] autolearn=no autolearn_force=no Received: from mailgateway.locotech.fi ([127.0.0.1]) by localhost (mailgateway.locotech.fi [127.0.0.1]) (amavisd-new, port 10024) with LMTP id p21S3dAg8RyS; Sat, 6 Aug 2016 19:37:21 +0300 (EEST) Received: from posti.fimnet.fi (posti.fimnet.fi [172.16.1.44]) by mailgateway.locotech.fi (Postfix) with ESMTP id 122EDA36299; Sat, 6 Aug 2016 19:37:20 +0300 (EEST) Received: from k-piste.dy.fi (unknown [172.16.1.39]) by posti.fimnet.fi (Postfix) with ESMTPSA id D286910180D; Sat, 6 Aug 2016 19:37:20 +0300 (EEST) Received: from localhost.localdomain ([::1] helo=k-piste.dy.fi) by k-piste.dy.fi with esmtp (Exim 4.87) (envelope-from ) id 1bW4bA-0001aK-HR; Sat, 06 Aug 2016 19:37:20 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sat, 06 Aug 2016 19:37:20 +0300 To: "Charles R. Portwood II" Cc: Niklas Keller , Tom Worster , PHP internals , charlesportwoodii@ethreal.net In-Reply-To: References: <81b5a129-9c90-0a54-921f-7e1f9b5f727f@thefsb.org> <9d2ef6f3a84333f35ebcb843ade65c22@k-piste.dy.fi> Message-ID: <05cf17898a22abc41664004ef8731342@k-piste.dy.fi> X-Sender: lauri.kentta@gmail.com User-Agent: Roundcube Webmail/1.2.1 Subject: Re: [PHP-DEV] Re: [RFC][DISCUSSION] Argon2 Password Hash From: lauri.kentta@gmail.com (=?UTF-8?Q?Lauri_Kentt=C3=A4?=) On 2016-08-06 17:47, Charles R. Portwood II wrote: > Absolutely. What are your thoughts on the following cost factors? > > time_cost = 3 > memory_cost = 12 > threads = 1 > > The reference library provides a CLI program where these values are > listed. A memory_cost factor of 12 would be 4 MiB. Looks like there's already some ambiguity in the parameters. As I understand it, m_cost is the memory size in kilobytes. Thus, m_cost = 4096 would be 4 MiB. The source file you referenced [1] has actually LOG_M_COST_DEF, where m_cost = 1 << LOG_M_COST_DEF. Testing with argon2_cffi [2] (Python) shows that your parameters (with m_cost = 4096 = 4 MiB) take 57 ms per hash on my laptop and 14 ms on my VPS, compared to bcrypt cost 10 taking 88 ms. Personally, I would be satisfied with even smaller parameters, maybe something like memory_cost 512, time_cost 2, threads 2. Disclaimer: I'm not familiar with Argon2, I only looked shortly at the source files and the Python library [2]. However, care should be taken to use the correct definition for m_cost. [1] https://github.com/P-H-C/phc-winner-argon2/blob/master/src/run.c#L27 [2] http://argon2-cffi.readthedocs.io/en/stable/parameters.html -- Lauri Kenttä