• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/crypt.php
  • Класс: CCryptrc4
  • Вызов: CCryptrc4::__Init
function __Init($key)
{
	$this->arKey[] = "";
	$this->arBox[] = "";

	$keyLength = mb_strlen($key);

	for ($i = 0; $i < 256; $i++)
	{
		$this->arKey[$i] = ord(mb_substr($key, ($i % $keyLength), 1));
		$this->arBox[$i] = $i;
	}

	for ($j = $i = 0; $i < 256; $i++)
	{
		$j = ($j + $this->arBox[$i] + $this->arKey[$i]) % 256;
		$this->arBox[$i] ^= $this->arBox[$j];
		$this->arBox[$j] ^= $this->arBox[$i];
		$this->arBox[$i] ^= $this->arBox[$j];
	}
}