Skip to content
This repository
Browse code

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

…timeouts.
  • Loading branch information...
commit 09e821efc3ee79ca6254957acfbc6b2640239807 1 parent a1e7c1f
Sam Minnée authored June 15, 2012

Showing 1 changed file with 4 additions and 7 deletions. Show diff stats Hide diff stats

  1. 11  tests/security/PasswordEncryptorTest.php
11  tests/security/PasswordEncryptorTest.php
@@ -15,6 +15,7 @@ public function setUp() {
15 15
 	public function tearDown() {
16 16
 		parent::tearDown();
17 17
 		Config::set_instance($this->config);
  18
+		PasswordEncryptor_Blowfish::set_cost(10);
18 19
 	}
19 20
 
20 21
 	function testCreateForCode() {
@@ -86,12 +87,12 @@ function testEncryptorBlowfish() {
86 87
 		$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
87 88
 		$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
88 89
 
89  
-		PasswordEncryptor_Blowfish::set_cost(15);
  90
+		PasswordEncryptor_Blowfish::set_cost(11);
90 91
 		$salt = $e->salt($password);
91 92
 		$modSalt = substr($salt, 0, 3) . str_shuffle(substr($salt, 3, strlen($salt)));
92 93
 
93  
-		$this->assertEquals(15, PasswordEncryptor_Blowfish::get_cost());
94  
-
  94
+		$this->assertEquals(11, PasswordEncryptor_Blowfish::get_cost());
  95
+		
95 96
 		$this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
96 97
 		$this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
97 98
 		$this->assertFalse($e->check($e->encrypt($password, $salt), "mypassword", $modSalt));
@@ -103,10 +104,6 @@ function testEncryptorBlowfish() {
103 104
 		$this->assertEquals(31, PasswordEncryptor_Blowfish::get_cost());
104 105
 
105 106
 		//Don't actually test this one. It takes too long. 31 takes too long to process
106  
-		// $salt = $e->salt($password);
107  
-		// $this->assertTrue($e->check($e->encrypt($password, $salt), "mypassword", $salt));
108  
-		// $this->assertFalse($e->check($e->encrypt($password, $salt), "anotherpw", $salt));
109  
-
110 107
 	}
111 108
 	
112 109
 	function testEncryptorPHPHashCheck() {

0 notes on commit 09e821e

Please sign in to comment.
Something went wrong with that request. Please try again.