Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…timeouts.
  • Loading branch information...
commit 09e821efc3ee79ca6254957acfbc6b2640239807 1 parent a1e7c1f
Sam Minnée sminnee authored
Showing with 4 additions and 7 deletions.
  1. +4 −7 tests/security/PasswordEncryptorTest.php
11 tests/security/PasswordEncryptorTest.php
View
@@ -15,6 +15,7 @@ public function setUp() {
public function tearDown() {
parent::tearDown();
Config::set_instance($this->config);
+ PasswordEncryptor_Blowfish::set_cost(10);
}
function testCreateForCode() {
@@ -86,12 +87,12 @@ function testEncryptorBlowfish() {
$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));
$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
@@ -103,10 +104,6 @@ function testEncryptorBlowfish() {
$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() {
Please sign in to comment.
Something went wrong with that request. Please try again.