• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/crypt.php
  • Класс: CCrypt
  • Вызов: CCrypt::__construct
public function __construct($blockCipherMode = CRYPT_MODE_CBC, $cipher = "blowfish", $key = "", $iv = "")
{
	$cipher = mb_strtolower($cipher);

	if (!class_exists("CCrypt".$cipher))
	{
		$this->errorMessage = "Class 'CCrypt".$cipher."' doesn't exists";
	}
	else
	{
		$class = "CCrypt".$cipher;
		$this->cipher = new $class($key);
		$this->blockCipherMode = $blockCipherMode;
		$this->key = $key;
		$this->iv = $iv;

		switch ($this->blockCipherMode)
		{
			case CRYPT_MODE_ECB:
				break;

			case CRYPT_MODE_CBC:
				if ($this->iv == '')
					$this->CreateIV();
				break;

			default:
				$this->errorMessage = "Invalid mode '".$this->blockCipherMode."'";
		}
	}
}