- md5
- 544591060f70244936071d6cb98091ae
- sha1
- ac9c7d73c95d5dbe6df6440f2ce4e15a8f1698d4
- sha256
- d50d669343b9ad3b47aec6b4f1806e0d0b261c6d2add47def12b348b05f237ef
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Authentication\Password;
\defined('JPATH_PLATFORM') or die;
use Joomla\Authentication\Password\HandlerInterface;
/**
* Password handler for PHPass hashed passwords
*
* @since 4.0.0
* @deprecated 5.0 Support for PHPass hashed passwords will be removed
*/
class PHPassHandler implements HandlerInterface, CheckIfRehashNeededHandlerInterface
{
/**
* Check if the password requires rehashing
*
* @param string $hash The password hash to check
*
* @return boolean
*
* @since 4.0.0
*/
public function checkIfRehashNeeded(string $hash): bool
{
return true;
}
/**
* Generate a hash for a plaintext password
*
* @param string $plaintext The plaintext password to validate
* @param array $options Options for the hashing operation
*
* @return string
*
* @since 4.0.0
*/
public function hashPassword($plaintext, array $options = [])
{
return $this->getPasswordHash()->HashPassword($plaintext);
}
/**
* Check that the password handler is supported in this environment
*
* @return boolean
*
* @since 4.0.0
*/
public static function isSupported()
{
return class_exists(\PasswordHash::class);
}
/**
* Validate a password
*
* @param string $plaintext The plain text password to validate
* @param string $hashed The password hash to validate against
*
* @return boolean
*
* @since 4.0.0
*/
public function validatePassword($plaintext, $hashed)
{
return $this->getPasswordHash()->CheckPassword($plaintext, $hashed);
}
/**
* Get an instance of the PasswordHash class
*
* @return \PasswordHash
*
* @since 4.0.0
*/
private function getPasswordHash(): \PasswordHash
{
return new \PasswordHash(10, true);
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.