diff --git a/lib/Cake/Test/Case/Utility/SecurityTest.php b/lib/Cake/Test/Case/Utility/SecurityTest.php index ea7d6fa29..c6c017df6 100644 --- a/lib/Cake/Test/Case/Utility/SecurityTest.php +++ b/lib/Cake/Test/Case/Utility/SecurityTest.php @@ -147,9 +147,25 @@ class SecurityTest extends CakeTestCase { $this->assertSame(strlen(Security::hash($key, 'sha256', true)), 64); } + Security::setHash($_hashType); + } + +/** + * Test that hash() works with blowfish. + * + * @return void + */ + public function testHashBlowfish() { + Security::setCost(10); + $test = Security::hash('password', 'blowfish'); + $this->skipIf(strpos($test, '$2a$') === false, 'Blowfish hashes are incorrect.'); + + $_hashType = Security::$hashType; + + $key = 'someKey'; $hashType = 'blowfish'; Security::setHash($hashType); - Security::setCost(10); // ensure default cost + $this->assertSame(Security::$hashType, $hashType); $this->assertSame(strlen(Security::hash($key, null, false)), 60);