php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76290 Wrong info in argon2i memory_cost
Submitted: 2018-04-30 15:45 UTC Modified: 2018-04-30 18:22 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: redir1 at npn dot fi Assigned: cmb (profile)
Status: Closed Package: *Encryption and hash functions
PHP Version: 7.2.5 OS: N/A
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: redir1 at npn dot fi
New email:
PHP Version: OS:

 

 [2018-04-30 15:45 UTC] redir1 at npn dot fi
Description:
------------
---
From manual page: http://www.php.net/function.password-hash
---

The manual page says:
"memory_cost (integer) - Maximum memory (in bytes) that may be used to compute the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_MEMORY_COST."

The memory in reality is in kilobytes, not bytes. Confirmed by testing the memory usage, execution speed and also by reading the source code.

Test script:
---------------
password_hash('passu', PASSWORD_ARGON2I, [
    'memory_cost' => 1024 * 1024, // According to documentation, should be 1MB
    'time_cost' => 4,
    'threads' => 2,
]);

Expected result:
----------------
Check the memory usage of the script. It's 1GB.

Actual result:
--------------
Memory usage should not be a lot more than 1MB.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-30 15:48 UTC] redir1 at npn dot fi
Expected and actual results got mixed up, but the info remains the same.
 [2018-04-30 16:19 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: *Encryption and hash functions -Assigned To: +Assigned To: cmb
 [2018-04-30 17:12 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=344889
Log: Fix #76290: Wrong info in argon2i memory_cost
 [2018-04-30 17:13 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2018-04-30 17:13 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2018-04-30 17:58 UTC] redir1 at npn dot fi
Thanks for the fix to prevent further confusion.

However, please review the updated XMS. I believe it should be "kibibytes" instead of "kikibytes".
 [2018-04-30 17:59 UTC] redir1 at npn dot fi
-Status: Closed +Status: Assigned
 [2018-04-30 17:59 UTC] redir1 at npn dot fi
Reopen for a typo fix
 [2018-04-30 18:22 UTC] cmb@php.net
> I believe it should be "kibibytes" instead of "kikibytes".

Of course.  Thanks!

Fixed via <http://svn.php.net/viewvc?view=revision&revision=344891>.
 [2018-04-30 18:22 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=db38901efebe08ccea53c20fa3d8097ed7b5f7bb
Log: Fix #76290: Wrong info in argon2i memory_cost
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC