/**
  * @covers PasswordLib\Password\Implementation\PHPASS
  * @dataProvider provideTestDetect
  */
 public function testDetect($from, $expect)
 {
     $this->assertEquals($expect, PHPASS::detect($from));
 }
Beispiel #2
0
 /**
  * Return a valid hash for a password, of if the password is already hashed
  * just return as is.
  *
  * @param string $password
  *
  * @throws AccessControlException
  *
  * @return string
  */
 private function getValidHash($password)
 {
     if (Password\Blowfish::detect($password)) {
         return $password;
     }
     if (Password\PHPASS::detect($password)) {
         return $password;
     }
     if (strlen($password) < 6) {
         throw new AccessControlException('Can not save a password with a length shorter than 6 characters!');
     }
     return $this->passwordFactory->createHash($password, '$2y$');
 }