• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/crypt.php
  • Класс: CCrypt
  • Вызов: CCrypt::__DecryptCBC
function __DecryptCBC($cipher)
{
	$blockSize = $this->cipher->blockSize;
	$text = '';

	if ($blockSize <= 0)
	{
		$text = $this->cipher->__Decrypt($cipher);
	}
	else
	{
		$cipherLength = mb_strlen($cipher);
		$lastCipher = $this->iv;

		for ($i = 0; $i < $cipherLength; $i = $i + $blockSize)
		{
			$block = mb_substr($cipher, $i, $blockSize);

			$decryptBlock = $lastCipher ^ $this->cipher->__Decrypt($block);
			$lastCipher = $block;

			while (mb_substr($decryptBlock, 0, 1) == "")
				$decryptBlock = mb_substr($decryptBlock, 1);

			$text .= $decryptBlock;
		}
	}

	return $text;
}