1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

password_hash: Increase PHP_PASSWORD_BCRYPT_COST to 12 (#12367)

RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
This commit is contained in:
Tim Düsterhus
2023-10-06 14:27:01 +02:00
committed by GitHub
parent 4c22060f1d
commit 42a85fc5d9
5 changed files with 13 additions and 4 deletions

1
NEWS
View File

@@ -25,6 +25,7 @@ Standard:
. Partly fix GH-12143 (Incorrect round() result for 0.49999999999999994).
(timwolla)
. Fix GH-12252 (round(): Validate the rounding mode). (timwolla)
. Increase the default BCrypt cost to 12. (timwolla)
XSL:
. Implement request #64137 (XSLTProcessor::setParameter() should allow both

View File

@@ -80,6 +80,10 @@ PHP 8.4 UPGRADE NOTES
would have resulted in 1.0 instead of the correct result 0.0. Additional
inputs might also be affected and result in different outputs compared to
earlier PHP versions.
. The default value of the 'cost' option for PASSWORD_BCRYPT for password_hash()
has been increased from '10' to '12'.
RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
========================================
6. New Functions

View File

@@ -22,7 +22,7 @@ PHP_MINIT_FUNCTION(password);
PHP_MSHUTDOWN_FUNCTION(password);
#define PHP_PASSWORD_DEFAULT PHP_PASSWORD_BCRYPT
#define PHP_PASSWORD_BCRYPT_COST 10
#define PHP_PASSWORD_BCRYPT_COST 12
#ifdef HAVE_ARGON2LIB
/**

View File

@@ -1,10 +1,12 @@
--TEST--
Test normal operation of password_hash()
--SKIPIF--
<?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?>
--FILE--
<?php
//-=-=-=-
var_dump(strlen(password_hash("foo", PASSWORD_BCRYPT)));
var_dump(password_hash("foo", PASSWORD_BCRYPT));
$algos = [
PASSWORD_BCRYPT,
@@ -19,8 +21,8 @@ foreach ($algos as $algo) {
echo "OK!";
?>
--EXPECT--
int(60)
--EXPECTF--
string(60) "$2y$12$%s"
bool(true)
bool(true)
bool(true)

View File

@@ -1,5 +1,7 @@
--TEST--
Test removed support for explicit salt option
--SKIPIF--
<?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?>
--FILE--
<?php
//-=-=-=-