private function doHash(PasswordHasher $hasher, $algo, $password) { $password = new Password($password); $hash = $hasher->make($password); $this->assertInstanceOf(BcryptPasswordHash::class, $hash); $this->assertTrue(password_verify((string) $password, (string) $hash)); $hash = new BcryptPasswordHash(password_hash((string) $password, $algo), $hasher); $this->assertTrue($hasher->check($password, $hash)); $this->assertFalse($hasher->needsRehash($hash)); $hash = new BcryptPasswordHash(password_hash((string) $password, $algo, ['cost' => 9]), $hasher); $this->assertTrue($hasher->needsRehash($hash)); }
/** * Checks if this hash needs to be re-hashed * * @return boolean True if it needs re-hashing, false otherwise */ public function needsRehash() { return $this->hasher->needsRehash($this); }