• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/captcha.php
  • Класс: CCaptcha
  • Вызов: CCaptcha::SetCodeCrypt
function SetCodeCrypt($password = "")
{
	if (!defined("CAPTCHA_COMPATIBILITY"))
	{
		CCaptcha::SetCaptchaCode();
		return;
	}

	$max = count($this->arChars);

	$this->code = "";
	for ($i = 0; $i < $this->codeLength; $i++)
		$this->code .= $this->arChars[rand(1, $max) - 1];

	if (!BitrixMainApplication::getInstance()->getSession()->get("CAPTCHA_PASSWORD"))
		BitrixMainApplication::getInstance()->getSession()["CAPTCHA_PASSWORD"] = randString(10);

	$this->codeCrypt = $this->CryptData($this->code, "E", BitrixMainApplication::getInstance()->getSession()["CAPTCHA_PASSWORD"]);
}