Example #1
0
 public function testCalcWithWrongSalt()
 {
     if (!extension_loaded('mhash')) {
         $this->markTestSkipped('The mhash extension is not available');
         return;
     }
     $this->setExpectedException('Zend\\Crypt\\Key\\Derivation\\Exception\\InvalidArgumentException', 'The salt size must be at least of 8 bytes');
     $password = SaltedS2k::calc('sha256', 'test', substr($this->salt, -1), 32);
 }
Example #2
0
 /**
  * @param mixed $password
  */
 public function setPassword($password)
 {
     $salt = Rand::getBytes(32, true);
     $salt = SaltedS2k::calc('sha256', $password, $salt, 100000);
     $bcryp = new Bcrypt();
     $bcryp->setSalt($salt);
     $this->password = $bcryp->create($password);
 }