pepper = $pepper; $this->hashAlgo = $hashAlgo; } public function hash(string $plainPassword, string $salt = null): string { if ($this->isPasswordTooLong($plainPassword)) { throw new InvalidPasswordException(); } $hash = hash($this->hashAlgo, $plainPassword.$salt.$this->pepper); return $hash; } public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool { if ('' === $plainPassword || $this->isPasswordTooLong($plainPassword)) { return false; } if ($this->hash($plainPassword, $salt) === $hashedPassword) { return true; } else { throw new InvalidSQLPasswordException(); } } public function needsRehash(string $hashedPassword): bool { return false; } }