|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-09-18 09:40 UTC] phpdoc at mail dot my1 dot info
Description:
------------
for some reason using argon2i as a hash algorithm, it always dumps out a NUL byte at the end which doesnt happen with bcrypt.
I just use the PHP7.2-RC2 x64-nts from windows.php.net on a webserver using cgi
Test script:
---------------
<?php
header("Content-type: text/plain");
$pwhash=password_hash("php",PASSWORD_ARGON2I,[
'memory_cost' => 16384, // 16 Mb
'time_cost' => 2,
'threads' => 4,]);
echo $pwhash;
$pwhash2=password_hash("php",PASSWORD_BCRYPT,[
"cost"=> 10]);
echo PHP_EOL.PHP_EOL;
echo $pwhash2;
Expected result:
----------------
that it wont dump a NUL at the end
Actual result:
--------------
it does throw a NUL byte at the end.
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
by the way, password_verify, doesnt care whether the NUL exists. the test script can be expanded by: var_dump(password_verify("php",$pwhash)); var_dump(password_verify("php",trim($pwhash)));