# PHP 7.1 - Argon2

- Thread: https://externals.io/message/90474
- Original archive: https://news-web.php.net/php.internals/90474
- Started by Scott Arciszewski on 2016-01-11T06:57:15+00:00
- Messages: 9
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #90474 — Scott Arciszewski — 2016-01-11T06:57:15+00:00

URL: https://externals.io/message/90474#90474

Does adding Argon2 as a possible choice for `password_hash()` +
 `password_verify()` need an RFC? Or can I just submit a pull request?

It won't be changing the default in 7.1, and IIRC this sort of change
was already agreed upon as part of the original `password_hash()` RFC.

Scott Arciszewski
Chief Development Officer
Paragon Initiative Enterprises <https://paragonie.com

---

## #90477 — me@rouvenwessling.de — 2016-01-11T09:12:40+00:00

URL: https://externals.io/message/90474#90477 · In reply to: #90474

> 
> 
> Does adding Argon2 as a possible choice for `password_hash()` +
> `password_verify()` need an RFC? Or can I just submit a pull request?

The original RFC (https://wiki.php.net/rfc/password_hash) contained the following text:

> I'd propose the following policy for updating the default hashing algorithm in future releases of PHP.
> 
> * Any new algorithm must be in core for at least 1 full release of PHP prior to becoming default. So if scrypt is added in 5.5.5, it wouldn't be eligible for default until 5.7 (since 5.6 would be the full release). But if jcrypt (making it up) was added in 5.6.0, it would also be eligible for default at 5.7.0.
> * The default should only change on a full release (5.6.0, 6.0.0, etc) and not on a revision release. The only exception to this is in an emergency when a critical security flaw is found in the current default.
> * For a normal (non-emergency) change in default, an RFC shall be issued for the update of the default algorithm, following normal RFC rules.

So technically I don’t think it would be necessary to have an RFC to add another algorithm, though I think it might be nice as this is certainly a place where things shouldn’t be changed willy nilly. 

> It won't be changing the default in 7.1, and IIRC this sort of change
> was already agreed upon as part of the original `password_hash()` RFC.

I’m not really qualified to discuss the merits of the algorithm but a couple of questions:

* Is there already a crypt scheme for Argon2? Or are there any efforts to define one? It would good if PHP wouldn’t be an island.
* Back in July, when it won the PHC, it wasn’t deemed production ready as they wanted to make a few tweaks. Is that completed?
* Are you proposing to use Argon2d or Argon2i?

Lastly, I think it would be a good start to implement Argon2 in ext-hash.

Best regards
Rouven

---

## #90479 — Chris Riley — 2016-01-11T11:43:37+00:00

URL: https://externals.io/message/90474#90479 · In reply to: #90477

>
> > […]
>
> The original RFC (https://wiki.php.net/rfc/password_hash) contained the
> following text:
>
> > […]
> algorithm in future releases of PHP.
> > […]
> prior to becoming default. So if scrypt is added in 5.5.5, it wouldn't be
> eligible for default until 5.7 (since 5.6 would be the full release). But
> if jcrypt (making it up) was added in 5.6.0, it would also be eligible for
> default at 5.7.0.
> > […]
> and not on a revision release. The only exception to this is in an
> emergency when a critical security flaw is found in the current default.
> > […]
> for the update of the default algorithm, following normal RFC rules.
>
> So technically I don’t think it would be necessary to have an RFC to add
> another algorithm, though I think it might be nice as this is certainly a
> place where things shouldn’t be changed willy nilly.
>
> > […]
>
> I’m not really qualified to discuss the merits of the algorithm but a
> couple of questions:
>
> * Is there already a crypt scheme for Argon2? Or are there any efforts to
> define one? It would good if PHP wouldn’t be an island.
> * Back in July, when it won the PHC, it wasn’t deemed production ready as
> they wanted to make a few tweaks. Is that completed?
> * Are you proposing to use Argon2d or Argon2i?
>
> Lastly, I think it would be a good start to implement Argon2 in ext-hash.
>
> Best regards
> Rouven
> --
> 
> 
>
>
I was considering the same for adding scrypt; however there (isn't|wasn't|I
couldn't find) a crypt scheme for it and having a custom algorithm
identifier for php seemed like a bad idea.

~C

---

## #90483 — Pierre Joye — 2016-01-11T12:27:34+00:00

URL: https://externals.io/message/90474#90483 · In reply to: #90477

Hi,

>
>
> > […]
>
> The original RFC (https://wiki.php.net/rfc/password_hash) contained the
following text:
>
> > […]
algorithm in future releases of PHP.
> > […]
prior to becoming default. So if scrypt is added in 5.5.5, it wouldn't be
eligible for default until 5.7 (since 5.6 would be the full release). But
if jcrypt (making it up) was added in 5.6.0, it would also be eligible for
default at 5.7.0.
> > […]
and not on a revision release. The only exception to this is in an
emergency when a critical security flaw is found in the current default.
> > […]
issued for the update of the default algorithm, following normal RFC rules.
>
> So technically I don’t think it would be necessary to have an RFC to add
another algorithm, though I think it might be nice as this is certainly a
place where things shouldn’t be changed willy nilly.
>
> > […]
>
> I’m not really qualified to discuss the merits of the algorithm but a
couple of questions:
>
> * Is there already a crypt scheme for Argon2? Or are there any efforts to
define one? It would good if PHP wouldn’t be an island.

https://github.com/P-H-C/phc-winner-argon2

The reference implementation. If anything we should use it.

I am not sure if we should bundle the library tho'.

> * Back in July, when it won the PHC, it wasn’t deemed production ready as
they wanted to make a few tweaks. Is that completed?
> * Are you proposing to use Argon2d or Argon2i?
>
> Lastly, I think it would be a good start to implement Argon2 in ext-hash.
>
> Best regards
> Rouven

---

## #90484 — me@rouvenwessling.de — 2016-01-11T12:55:50+00:00

URL: https://externals.io/message/90474#90484 · In reply to: #90483

> 
> 
> Hi,
> 
> > […]
> 
> https://github.com/P-H-C/phc-winner-argon2
> 
> The reference implementation. If anything we should use it.
> 
> I am not sure if we should bundle the library tho'.
> 
Thanks for the link. The included example seem to use $argon2i$ and $argon2d$ as crypt scheme. A cursory search didn’t show anyone else using Argon2 with a crypt scheme, so this would probably be good enough.

Best regards
Rouven

---

## #90497 — Anthony Ferrara — 2016-01-11T15:04:36+00:00

URL: https://externals.io/message/90474#90497 · In reply to: #90484

+ Solar Designer


>
> > […]
> Thanks for the link. The included example seem to use $argon2i$ and $argon2d$ as crypt scheme. A cursory search didn’t show anyone else using Argon2 with a crypt scheme, so this would probably be good enough.

To my understanding, the crypt scheme hasn't been formalized. Solar
Designer, can you confirm?

Anthony

---

## #90508 — Solar Designer — 2016-01-11T16:32:38+00:00

URL: https://externals.io/message/90474#90508 · In reply to: #90497

> To my understanding, the crypt scheme hasn't been formalized. Solar
> Designer, can you confirm?

I think it has been, in the way defined by encoding.c in:

https://github.com/P-H-C/phc-winner-argon2

$ echo password | ./argon2 salt | grep ^Encoded
Encoded: $argon2i$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$pDVCkCwe3h2SnqGPAGNoM36WzhyGPAd+bb3BLrxyzWw
$ echo password | ./argon2 salt -d | grep ^Encoded
Encoded: $argon2d$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$Js0T8jeqwDeja/AQ+x2o4SUn22MofUW2f88RlMRhQso

I haven't been involved in this closely, though.

Alexander

---

## #90525 — Scott Arciszewski — 2016-01-11T23:28:08+00:00

URL: https://externals.io/message/90474#90525 · In reply to: #90508

>
> 
> > […]
>
> I think it has been, in the way defined by encoding.c in:
>
> https://github.com/P-H-C/phc-winner-argon2
>
> $ echo password | ./argon2 salt | grep ^Encoded
> Encoded: $argon2i$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$pDVCkCwe3h2SnqGPAGNoM36WzhyGPAd+bb3BLrxyzWw
> $ echo password | ./argon2 salt -d | grep ^Encoded
> Encoded: $argon2d$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$Js0T8jeqwDeja/AQ+x2o4SUn22MofUW2f88RlMRhQso
>
> I haven't been involved in this closely, though.
>
> Alexander

I'm going to write the pull request tonight then. If there's any
reason to not merge it, please discuss it there.

Thanks Solar. :)

Scott Arciszewski
Chief Development Officer
Paragon Initiative Enterprises <https://paragonie.com

---

## #90530 — Pierre Joye — 2016-01-12T01:54:12+00:00

URL: https://externals.io/message/90474#90530 · In reply to: #90525

>
> On Mon, Jan 11, 2016 at 11:32 AM, Solar Designer <solar@openwall.com>
wrote:
> > […]
$argon2i$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$pDVCkCwe3h2SnqGPAGNoM36WzhyGPAd+bb3BLrxyzWw
> > […]
$argon2d$m=4096,t=3,p=1$c2FsdAAAAAAAAAAAAAAAAA$Js0T8jeqwDeja/AQ+x2o4SUn22MofUW2f88RlMRhQso
> > […]
>
> I'm going to write the pull request tonight then. If there's any
> reason to not merge it, please discuss it there.
>
> Thanks Solar. :)

That's great :)

And as it will not be enabled by default the risk of having to maintain our
own prefix can be minimized by adding a note stating the current situation.

Thanks :)
