diff options
author | Patrick Allaert <pa@ez.no> | 2014-11-15 19:26:38 +0100 |
---|---|---|
committer | Patrick Allaert <pa@ez.no> | 2014-11-15 19:26:42 +0100 |
commit | 05f66ef2e28120ef82b3a72f13988deccae332a9 (patch) | |
tree | 2c3aad726b4460ebd00e0dac88d8225cbc035afc | |
parent | c91b1168bc53c26f56fc65f16958b5be45ca5dc9 (diff) | |
download | password_compat-05f66ef2e28120ef82b3a72f13988deccae332a9.zip password_compat-05f66ef2e28120ef82b3a72f13988deccae332a9.tar.gz password_compat-05f66ef2e28120ef82b3a72f13988deccae332a9.tar.bz2 |
Missing PASSWORD_BCRYPT_DEFAULT_COST constant
This one is defined with PHP >= 5.5 and make this lib even more
compatible by possibly using it.
-rw-r--r-- | lib/password.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/password.php b/lib/password.php index e8ec028..a5c28d4 100644 --- a/lib/password.php +++ b/lib/password.php @@ -12,6 +12,7 @@ namespace { if (!defined('PASSWORD_DEFAULT')) { define('PASSWORD_BCRYPT', 1); + define('PASSWORD_BCRYPT_DEFAULT_COST', 10); define('PASSWORD_DEFAULT', PASSWORD_BCRYPT); /** @@ -39,8 +40,7 @@ if (!defined('PASSWORD_DEFAULT')) { $resultLength = 0; switch ($algo) { case PASSWORD_BCRYPT: - // Note that this is a C constant, but not exposed to PHP, so we don't define it here. - $cost = 10; + $cost = PASSWORD_BCRYPT_DEFAULT_COST; if (isset($options['cost'])) { $cost = $options['cost']; if ($cost < 4 || $cost > 31) { @@ -158,7 +158,7 @@ if (!defined('PASSWORD_DEFAULT')) { * 'algo' => 1, * 'algoName' => 'bcrypt', * 'options' => array( - * 'cost' => 10, + * 'cost' => PASSWORD_BCRYPT_DEFAULT_COST, * ), * ) * @@ -199,7 +199,7 @@ if (!defined('PASSWORD_DEFAULT')) { } switch ($algo) { case PASSWORD_BCRYPT: - $cost = isset($options['cost']) ? $options['cost'] : 10; + $cost = isset($options['cost']) ? $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; if ($cost != $info['options']['cost']) { return true; } |