aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-10-02 13:30:36 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-10-02 13:30:36 +0200
commitafb7d2e616db95add3c6ad9cc908df4218c6f3b7 (patch)
treed44613898b1fd72ce1ee7c77a2339e2553af3d30
parent356f3eef0760f85b947cbffbf87918544e0f6c9d (diff)
downloadforums-afb7d2e616db95add3c6ad9cc908df4218c6f3b7.tar
forums-afb7d2e616db95add3c6ad9cc908df4218c6f3b7.tar.gz
forums-afb7d2e616db95add3c6ad9cc908df4218c6f3b7.tar.bz2
forums-afb7d2e616db95add3c6ad9cc908df4218c6f3b7.tar.xz
forums-afb7d2e616db95add3c6ad9cc908df4218c6f3b7.zip
[feature/passwords] Rename manager methods to check() and hash()
These method names are more straightforward than the previous ones. PHPBB3-11610
-rw-r--r--phpBB/phpbb/passwords/manager.php4
-rw-r--r--tests/passwords/manager_test.php22
2 files changed, 13 insertions, 13 deletions
diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php
index b90775126c..6ec9eefaed 100644
--- a/phpBB/phpbb/passwords/manager.php
+++ b/phpBB/phpbb/passwords/manager.php
@@ -189,7 +189,7 @@ class manager
* @return string|bool Password hash of supplied password or false if
* if something went wrong during hashing
*/
- public function hash_password($password, $type = '')
+ public function hash($password, $type = '')
{
if (strlen($password) > 4096)
{
@@ -235,7 +235,7 @@ class manager
* @param string $hash Stored hash
* @return string|bool True if password is correct, false if not
*/
- public function check_hash($password, $hash)
+ public function check($password, $hash)
{
if (strlen($password) > 4096)
{
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php
index 082b309501..7e9ec3dfcf 100644
--- a/tests/passwords/manager_test.php
+++ b/tests/passwords/manager_test.php
@@ -79,7 +79,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
if (!$length)
{
- $this->assertEquals(false, $hash = $this->manager->hash_password($password, $type));
+ $this->assertEquals(false, $hash = $this->manager->hash($password, $type));
return;
}
$time = microtime(true);
@@ -87,7 +87,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
// Limit each test to 1 second
while ((microtime(true) - $time) < 1)
{
- $hash = $this->manager->hash_password($password, $type);
+ $hash = $this->manager->hash($password, $type);
preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match);
$this->assertEquals($prefix, $match[1]);
$this->assertEquals($length, strlen($hash));
@@ -126,10 +126,10 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
// Limit each test to 1 second
while ((microtime(true) - $time) < 1)
{
- $hash = $this->manager->hash_password($password, $hash_type);
- $this->assertEquals(true, $this->manager->check_hash($password, $hash));
+ $hash = $this->manager->hash($password, $hash_type);
+ $this->assertEquals(true, $this->manager->check($password, $hash));
$password .= $this->pw_characters[mt_rand(0, 66)];
- $this->assertEquals(false, $this->manager->check_hash($password, $hash));
+ $this->assertEquals(false, $this->manager->check($password, $hash));
}
// Check if convert_flag is correctly set
@@ -154,7 +154,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
*/
public function test_check_hash_exceptions($password, $hash, $expected)
{
- $this->assertEquals($expected, $this->manager->check_hash($password, $hash));
+ $this->assertEquals($expected, $this->manager->check($password, $hash));
}
public function test_hash_password_length()
@@ -167,7 +167,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
public function test_hash_password_8bit_bcrypt()
{
- $this->assertEquals(false, $this->manager->hash_password('foobarš¯„˛', 'passwords.driver.bcrypt'));
+ $this->assertEquals(false, $this->manager->hash('foobarš¯„˛', 'passwords.driver.bcrypt'));
}
public function test_combined_hash_data()
@@ -232,11 +232,11 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
// Limit each test to 1 second
while ((microtime(true) - $time) < 1)
{
- $hash = $this->manager->hash_password($password, $first_type);
- $combined_hash = $this->manager->hash_password($hash, $second_type);
- $this->assertEquals($expected, $this->manager->check_hash($password, $combined_hash));
+ $hash = $this->manager->hash($password, $first_type);
+ $combined_hash = $this->manager->hash($hash, $second_type);
+ $this->assertEquals($expected, $this->manager->check($password, $combined_hash));
$password .= $this->pw_characters[mt_rand(0, 66)];
- $this->assertEquals(false, $this->manager->check_hash($password, $combined_hash));
+ $this->assertEquals(false, $this->manager->check($password, $combined_hash));
// If we are expecting the check to fail then there is
// no need to run this more than once