• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/mfa/hotpalgorithm.php
  • Класс: BitrixMainSecurityMfaHotpAlgorithm
  • Вызов: HotpAlgorithm::verify
public function verify($input, $params = null)
{
	$input = (string)$input;

	if (!preg_match('#^d+$#D', $input))
	{
		throw new ArgumentOutOfRangeException('input', 'string with numbers');
	}

	$counter = (int)$params;
	$result = false;
	$window = $this->window;
	while ($window--)
	{
		if ($this->isStringsEqual($input, $this->generateOTP($counter)))
		{
			$result = true;
			break;
		}
		$counter++;
	}

	if ($result === true)
	{
		return [true, $counter + 1];
	}

	return [false, null];
}