Doc #75772 [Opn->Nab]: Incorrect limit specified on blowfish passwords

From: Date: Thu, 25 Jan 2018 20:20:25 +0000
Subject: Doc #75772 [Opn->Nab]: Incorrect limit specified on blowfish passwords
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15360@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75772&edit=1 ID: 75772 Updated by: vrana@php.net Reported by: Thomas_Gnandt at gmx dot net Summary: Incorrect limit specified on blowfish passwords -Status: Open +Status: Not a bug Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: In PHP, character == byte. Previous Comments: ------------------------------------------------------------------------ [2018-01-07 11:55:26] Thomas_Gnandt at gmx dot net Description: ------------ The documentation states "Using the PASSWORD_BCRYPT as the algorithm, will result in the password parameter being truncated to a maximum length of 72 characters." This is not true. The password is being truncated to a maximum length of 72 bytes. Since passwords should contain special characters, a lot of which are multi-byte, this should be clarified. This is incorrect both on the documentation for password_hash() as well as the documentation for crypt(). Test script: --------------- $pw = str_pad("", 71, 'a'); $salt = ['salt' => 'N9qo8uLOickgx2ZMRZoMye']; echo password_hash($pw . 'a', PASSWORD_DEFAULT, $salt ) . PHP_EOL; echo password_hash($pw . 'ä', PASSWORD_DEFAULT, $salt ) . PHP_EOL; echo password_hash($pw . 'ö', PASSWORD_DEFAULT, $salt ) . PHP_EOL; Expected result: ---------------- Three differnt hashes Actual result: -------------- $2y$10$N9qo8uLOickgx2ZMRZoMye5mlC/WoAmNnGP3YkHGchsBkco85S4ZC $2y$10$N9qo8uLOickgx2ZMRZoMyeWZPaNHNhngTN.zngPxYMmerH0ZknF7. $2y$10$N9qo8uLOickgx2ZMRZoMyeWZPaNHNhngTN.zngPxYMmerH0ZknF7. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75772&edit=1

« previous php.doc.bugs (#15360) next »