Esempio n. 1
0
 public function testVerifyPasswordHash()
 {
     $password = '******';
     $prefix = Blowfish::getPrefix();
     $crypt = new CryptLib();
     $test = $crypt->createPasswordHash($password, $prefix);
     $this->assertTrue($crypt->verifyPasswordHash($password, $test));
 }
Esempio n. 2
0
 /**
  * @covers CryptLib\Password\Implementation\Blowfish
  */
 public function test8bitPassword()
 {
     $hash = new Blowfish(10);
     $password = '******' . chr(128);
     if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
         $test = $hash->create($password);
         $this->assertEquals(60, strlen($test));
         $this->assertEquals(Blowfish::getPrefix(), substr($test, 0, 4));
     } else {
         $this->setExpectedException('\\RuntimeException');
         $test = $hash->create($password);
     }
 }
Esempio n. 3
0
 public static function provideTestCreate()
 {
     return array(array(Blowfish::getPrefix(), 60), array('$apr1$', 37), array('$S$', 98), array('$P$', 34), array('$H$', 34), array('$pbkdf$', 74));
 }
Esempio n. 4
0
 /**
  * @covers CryptLib\Password\Implementation\Blowfish::verify
  * @dataProvider provideTestVerify
  * @group Vectors
  */
 public function testVerify($pass, $expect, $value)
 {
     $apr = new Blowfish();
     $this->assertEquals($value, $apr->verify($pass, $expect));
 }