public function testHashPassword() { $hasher = new PasswordHash(8, true); $testPassword = '******'; for ($i = 0; $i < 10; $i++) { $hash = $hasher->HashPassword($testPassword); $this->assertTrue($hasher->CheckPassword($testPassword, $hash)); } }
protected function execute(InputInterface $input, OutputInterface $output) { $raw = $input->getArgument('raw'); $hash = $input->getArgument('hash'); if ($this->phpass->CheckPassword($raw, $hash)) { $output->writeln('Match? <info>YEP</info>'); } else { $output->writeln('Match? <error> NOPE </error>'); } }
/** * Check a raw password against a hash. * * @param string $hashed * @param string $raw * @return bool */ public function passwordMatches($hashed, $raw) { return $this->phpass->CheckPassword($raw, $hashed); }
protected function execute(InputInterface $input, OutputInterface $output) { $raw = $input->getArgument('raw'); $hash = $this->phpass->HashPassword($raw); $output->writeln('<info>Generated hash:</info> ' . $hash); }