MINOR: Don't leave cost=31 blowfish setting dormant in code, causing timeouts.

This commit is contained in:
Sam Minnee 2012-06-15 13:47:38 +12:00
parent a1e7c1f9bf
commit 09e821efc3

View File

@ -15,6 +15,7 @@ class PasswordEncryptorTest extends SapphireTest {
public function tearDown() {
parent::tearDown();
Config::set_instance($this->config);
PasswordEncryptor_Blowfish::set_cost(10);
}
function testCreateForCode() {
@ -86,11 +87,11 @@ class PasswordEncryptorTest extends SapphireTest {
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
PasswordEncryptor_Blowfish::set_cost(15);
PasswordEncryptor_Blowfish::set_cost(11);
$salt = $e->salt($password);
$modSalt = substr($salt, 0, 3) . str_shuffle(substr($salt, 3, strlen($salt)));
$this->assertEquals(15, PasswordEncryptor_Blowfish::get_cost());
$this->assertEquals(11, PasswordEncryptor_Blowfish::get_cost());
$this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
@ -103,10 +104,6 @@ class PasswordEncryptorTest extends SapphireTest {
$this->assertEquals(31, PasswordEncryptor_Blowfish::get_cost());
//Don't actually test this one. It takes too long. 31 takes too long to process
// $salt = $e->salt($password);
// $this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
// $this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
}
function testEncryptorPHPHashCheck() {