mirror of
https://github.com/php/php-src.git
synced 2026-04-22 23:48:14 +02:00
3f8961dfac
Apparently, `argon2_encodedlen()` also counts the terminating NUL byte; that doesn't appear to be documented somewhere, but from looking at the implementation[1] it is pretty obvious. Therefore, the respective `zend_string` has to be one byte shorter. [1] <https://github.com/P-H-C/phc-winner-argon2/blob/20161029/src/argon2.c#L431-L436>
20 lines
387 B
PHP
20 lines
387 B
PHP
--TEST--
|
|
Bug #75221 (Argon2i always throws NUL at the end)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$hash = password_hash(
|
|
"php",
|
|
PASSWORD_ARGON2I,
|
|
['memory_cost' => 16384, 'time_cost' => 2, 'threads' => 4]
|
|
);
|
|
var_dump(substr($hash, -1, 1) !== "\0");
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
bool(true)
|
|
===DONE===
|