• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/password.php
  • Класс: BitrixMainSecurityPassword
  • Вызов: Password::hash
static function hash($password, $salt = null): string
{
	if(CRYPT_SHA512 == 1)
	{
		//new SHA-512 method
		if($salt === null)
		{
			$salt = Random::getString(16, true);
		}
		//by default rounds=5000
		return crypt($password, '$6$'.$salt.'$');
	}
	else
	{
		//old md5 method
		if($salt === null)
		{
			$salt = Random::getStringByAlphabet(8, Random::ALPHABET_ALL);
		}
		return $salt.md5($salt.$password);
	}
}