https://gist.github.com/nikic/3707231
Checks if a password is valid against our database
@param string $password_hash     The password to check against
@return boolean
970687
protected function password_verify_with_rehash($password_hash, $bcryt_hash)
    {
        if (!password_verify($password_hash, $bcryt_hash))
           return false;

        if (password_needs_rehash($bcryt_hash, PASSWORD_BCRYPT, array('cost' => $this->_cost)))
        {
            // Update the hash in the db
            $this->getUser()->password = $this->password;
            return $this->getUser()->save();
        }

        // Otherwise return true
        return true;
    }
978790
public static function isValidPassword($username , $password)
	{
		if ( ! self::userExists( $username ) ) return false;
		$compute = self::getPasswordHash($username , $password);

		return ( $compute === self::$auth['users'][$username]['pwd'] );
	}
1116869
public function validate( $password )
    {
        $result = true;
        /** @var \tao_helpers_form_Validator $validator */
        foreach ($this->validators as $validator) {
            $result &= $validator->evaluate( $password );
        }

        return (boolean) $result;
    }
157329
public function is_valid($password, $check_rehash=true) {
	if (password_verify($password, $this->data['hash']) == false) {
		return false;
	}
	
	if ($check_rehash && password_needs_rehash($this->data['hash'], PASSWORD_DEFAULT)) {
		$new_hash = self::hash_password($password);
		$this->set_new_hash($this->data['user_id'], $this->data['email_address'], $new_hash);
	}
	
	return true;
}
423127
public function checkPassword($password) {
    switch (Tilmeld::$config['pw_method']) {
      case 'plain':
        return ($this->password == $password);
      case 'digest':
        return ($this->password == hash('sha256', $password));
      case 'salt':
      default:
        return ($this->password == hash('sha256', $password.$this->salt));
    }
  }
149795
public function needsRehash(string $hash)
    {
        if (substr($hash, 0, 1) !== "$")
            return true;

        $algorithm = $this->config->dget('algorithm', PASSWORD_DEFAULT);
        $options['cost'] = $this->config->dget('cost', 10);
        return password_needs_rehash($hash, $algorithm, $options);
    }
52202
public function validatePassword($password)
    {
        $phAttribute = $this->passwordHashAttribute;
        $result = Yii::$app->security->validatePassword($password, $this->$phAttribute);
        if ($result) {
            $this->trigger(static::$eventValidatePasswordSucceeded);
            return $result;
        }
        $this->trigger(static::$eventValidatePasswordFailed);
        return $result;
    }
87320
public function comparePasswords($password)
    {
        $passwordSalted = $this->saltPassword($password);
        if (password_verify($passwordSalted, $this->privateKey)) {
            return true;
        }
        
        return false;
    }
438138
public function validatePassword($password)
    {
        return Yii::$app->security->validatePassword($password.$this->password_salt, $this->password);
    }
982493
function validatePassword( $password )
    {
        eZDebug::writeDebug( 'Validate Password Start','eZPaEx::validatePassword' );
        if ( $this->hasRegexp() && ( $password != '_ezpassword' ) )
        {
            $regexp = preg_replace( array('/(^\/)/', '/(\/$)/'), '', $this->attribute( 'passwordvalidationregexp' ) );
            if ( !preg_match( '/' . $regexp . '/', $password ) )
            {
                eZDebug::writeDebug( 'Password KO', 'eZPaEx::validatePassword' );
                return false;
            }
        }
        eZDebug::writeDebug( 'Password OK', 'eZPaEx::validatePassword' );

        return true;
    }
1127956
public function checkPassword($password)
    {
        Deprecation::notice('5.0', 'Use Authenticator::checkPassword() instead');

        // With a valid user and password, check the password is correct
        $result = ValidationResult::create();
        $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::CHECK_PASSWORD);
        foreach ($authenticators as $authenticator) {
            $authenticator->checkPassword($this, $password, $result);
            if (!$result->isValid()) {
                break;
            }
        }
        return $result;
    }
65520
public function validatePasswordNotUseWordPassword($password) {
        $washedPassword = trim($password);
        $washedPassword = strtolower($password);

        // if the word "password" resides within the password, then no good
        if (strpos($washedPassword, "password") !== false) {
            return false;
        }

        return true;
    }
956084
public function passwordMatches($password, $user)
    {
        if (!is_array($user)) {
            $user = $this->get($user);
        }

        if (empty($user['hash'])) {
            return false;
        }

        return gplcart_string_equals($user['hash'], gplcart_string_hash($password, $user['hash'], 0));
    }
1142474
function password_hash($password)
	{
		$result = md5($password);
		if (!$this->conf['backward']['weak_password'])
		{
			$result = md5($result);
		}
		return $result;
	}
1174305
public function comparePasswords($userid, $password_for_check)
    {
        $query = "SELECT password FROM {$this->config->table_users} WHERE id = ?";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute([$userid]);

        $data = $query_prepared->fetch(\PDO::FETCH_ASSOC);

        if (!$data) {
            return false;
        }

        return password_verify($password_for_check, $data['password']);
    }
739653
public function hash_password($password)
	{
		return base64_encode($this->hasher()->pbkdf2($password, \Config::get('auth.salt'), \Config::get('auth.iterations', 10000), 32));
	}
841104
public function checkPassword($password, $storedHash)
    {
        $hash = $this->_crypt($password, $storedHash);

        return ($hash == $storedHash);
    }