diff --git a/phpBB/includes/crypto/driver/salted_md5.php b/phpBB/includes/crypto/driver/salted_md5.php index 76bbdccbc4..c5a8345453 100644 --- a/phpBB/includes/crypto/driver/salted_md5.php +++ b/phpBB/includes/crypto/driver/salted_md5.php @@ -82,9 +82,9 @@ class phpbb_crypto_driver_salted_md5 extends phpbb_crypto_driver_base */ public function check($password, $hash) { - if (strlen($hash) != 34) + if (strlen($hash) !== 34) { - return false; + return (md5($password) === $hash) ? true : false; } // No need to check prefix, already did that in manage diff --git a/phpBB/includes/crypto/manager.php b/phpBB/includes/crypto/manager.php index 7f95bcdf60..753a86ae84 100644 --- a/phpBB/includes/crypto/manager.php +++ b/phpBB/includes/crypto/manager.php @@ -112,7 +112,7 @@ class phpbb_crypto_manager */ if (!preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match)) { - return false; + return $this->type_map['$H$']; } // Be on the lookout for multiple hashing algorithms diff --git a/tests/crypto/manager_test.php b/tests/crypto/manager_test.php index df3e51bd75..2b6e1b311e 100644 --- a/tests/crypto/manager_test.php +++ b/tests/crypto/manager_test.php @@ -131,7 +131,7 @@ class phpbb_crypto_manager_test extends PHPUnit_Framework_TestCase public function check_hash_exceptions_data() { return array( - array('foobar', '3858F62230AC3C915F300C664312C63F', false), + array('foobar', '3858f62230ac3c915f300c664312c63f', true), array('foobar', '$S$b57a939fa4f2c04413a4eea9734a0903647b7adb93181295', false), array('foobar', '$2a\S$kkkkaakdkdiej39023903204j2k3490234jk234j02349', false), array('foobar', '$H$kklk938d023k//k3023', false),