@param string $password

@return array
168053
protected static function getSubstitutions($password)
    {
        $map = [];

        $l33t = [
            'a' => ['4', '@'],
            'b' => ['8'],
            'c' => ['(', '{', '[', '<'],
            'e' => ['3'],
            'g' => ['6', '9'],
            'i' => ['1', '!', '|'],
            'l' => ['1', '|', '7'],
            'o' => ['0'],
            's' => ['$', '5'],
            't' => ['+', '7'],
            'x' => ['%'],
            'z' => ['2'],
        ];
        // Simplified l33t table to reduce duplicates.
        $l33t = [
            'a' => ['4', '@'],
            'b' => ['8'],
            'c' => ['(', '{', '[', '<'],
            'e' => ['3'],
            'g' => ['6', '9'],
            'i' => ['1', '!'],
            'l' => ['|', '7'],
            'o' => ['0'],
            's' => ['$', '5'],
            't' => ['+', '7'],
            'x' => ['%'],
            'z' => ['2'],
        ];

        /*$chars = array_unique(str_split($password));
        foreach ($l33t as $letter => $subs) {
            $relevent_subs = array_intersect($subs, $chars);
            if (!empty($relevent_subs)) {
                $map[] = $relevent_subs;
            }
        }*/

        foreach (range(0, strlen($password) - 1) as $i) {
            $map[$i] = null;
            foreach ($l33t as $char => $subs) {
                if (in_array($password[$i], $subs, true)) {
                    $map[$i] = $char;
                }
            }
        }

        return $map;
    }
1069050
public static function passwordHash(string $password) : string
    {
        //cant use it aas a object property cause php sucks and can call a function on a property with a array -_-
        $options = [
            //'salt' => mcrypt_create_iv(22, MCRYPT_DEV_URANDOM), // Never use a static salt or one that is not randomly generated.
            'cost' => 12, // the default cost is 10
        ];

        $hash = password_hash($password, PASSWORD_DEFAULT, $options);

        return $hash;
    }
1255344
public static function gen($password)
    {
        return crypt($password, self::$algo . self::$cost . '$' . self::uniqueSalt());
    }
1125437
public function validatePassword(string $password): bool
    {
        return \Yii::$app->security->validatePassword($password, $this->password_hash);
    }
1276763
public function hashPassword($password)
    {
        if ($this->mode == self::MODE_BCRYPT) {
            return $this->hashModeBcrypt($password);
        } elseif ($this->mode == self::MODE_PBKDF2) {
            return $this->hashModePbkdf2($password);
        }

        $this->error = 'You have to set the mode...';
        $this->cwsDebug->error($this->error);
    }
1058454
function ntPasswordHash($password = null)
    {
        if (isset($password)) {
            return pack('H*',hash('md4', $this->str2unicode($password)));
        } else {
            return pack('H*',hash('md4', $this->str2unicode($this->password)));
        }
    }
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));
    }
1367923
public static function analyze($password)
	{
		$stats = array();

		$len = strlen($password);

		$stats['count'][0] = $len;
		$stats['uniqueCharacters'] = 0;
		$stats['uniqueClasses']    = 0;

		$classes   = array();
		$histogram = array();

		for ($i = 0; $i < $len; $i++)
		{
			$c = $password[$i];

			$cl = CharacterClass::match($c);

			foreach ($cl as $class)
			{
				if (empty($stats['count'][$class->name]))
				{
					$stats['count'][$class->name] = 1;
					if ($class->flag)
					{
						$stats['uniqueClasses']++;
					}
				}
				else
				{
					$stats['count'][$class->name]++;
				}
			}

			if (empty($histogram[$c]))
			{
				$histogram[$c] = 1;
				$stats['uniqueCharacters']++;
			}
			else
			{
				$histogram[$c]++;
			}
		}

		return $stats;
	}
1008244
public function setPassword($password)
        {
            if ($this->validatePassword($password) === false) {
                throw new Exception("Password \"$password\" is not a valid HTTP password.");
            }

            $oldPassword     = $this->_password;
            $this->_password = $password;

            return $oldPassword;
        }
277073
public function checkUserCredentials($username, $password)
    {
        $userDetails = $this->getUserDetails($username);

        return $userDetails && $userDetails['password'] && $userDetails['password'] === $password;
    }
746117
public static function getSaltedPasswordHash($password)
    {
        return hash('sha512', \App\Registry::$config->salt . md5($password) . $password . 'sltd');
    }
598439
public static function create($password): string
    {
        if (!$password) {
            throw new \RuntimeException('Password hashing failed: no password provided.');
        }

        $hash = password_hash($password, PASSWORD_DEFAULT);

        if (!$hash) {
            throw new \RuntimeException('Password hashing failed: internal error.');
        }

        return $hash;
    }
299991
public function getMatches($password, array $userInputs = [])
    {
        $matches = [];
        foreach ($this->getMatchers() as $matcher) {
            $matched = $matcher::match($password, $userInputs);
            if (is_array($matched) && !empty($matched)) {
                $matches = array_merge($matches, $matched);
            }
        }

        return $matches;
    }
501157
protected function bCrypt($password)
    {
        if ($this->isSamePasswordOption()) {
            $result = $this->gameDataService->hashPassword($password);
        } else {
            $bCrypt = new Bcrypt();
            $result = $bCrypt->create($password);
        }

        return $result;
    }
1269758
protected function saltPassword($password)
    {
        if (isset($this->metaData['salt'])) {
            $salt = $this->metaData['salt'];
        } else {
            $salt = $this->generateSalt();
        }
        
        return $salt . $password;
    }
495250
public function decryptResponseHeader(array $responseHeader, $password): array
    {
        $this->getFactory()->createComputopApiConverter()->checkEncryptedResponse($responseHeader);

        $responseDecryptedString = $this->getBlowfishDecryptedValue(
            $responseHeader[ComputopApiConfig::DATA],
            $responseHeader[ComputopApiConfig::LENGTH],
            $password
        );

        $responseDecryptedArray = $this
            ->getFactory()
            ->createComputopApiConverter()
            ->getResponseDecryptedArray($responseDecryptedString);

        return $responseDecryptedArray;
    }
1339623
private function hashModeBcrypt($password)
    {
        $this->cwsDebug->titleH2('Create password hash using BCRYPT');
        $this->cwsDebug->labelValue('Password', $password);

        $ite = rand(self::BCRYPT_MIN_ITE, self::BCRYPT_MAX_ITE);
        $this->cwsDebug->labelValue('Iterations', $ite);

        $salt = $this->getBlowfishSalt($ite);
        $this->cwsDebug->labelValue('Salt', $salt);

        $hash = crypt($password, $salt);
        $this->cwsDebug->labelValue('Hash', $hash);
        $this->cwsDebug->labelValue('Length', strlen($hash));

        if (CRYPT_BLOWFISH == 1 && strlen($hash) == self::BCRYPT_LENGTH) {
            return $hash;
        }

        $this->error = 'Cannot generate the BCRYPT password hash...';
        $this->cwsDebug->error($this->error);
    }