Hotspot external login password hashing

Hello,
I’m trying use hotspot with external page but with page in ASP. With PAP authorization everything works good but I prefer CHAP. I think problem is with generating password MD5 hash. I don’t understand input format of chap-id and chap-challenge so I can’t generate hash correctly.

I tried to get expected data from php login page (template from documentation) with little modification:

<?php
   $chapid="\115";
   $chapchallenge="\274\013\242\243\236\226\151\224\070\023\243\207\252\061\016\254";
?>
<body onload="Test()">

	<script type="text/javascript" src="./md5.js"></script>
	<script type="text/javascript">
		function Test()
		{
			alert('<?php echo $chapid; ?>' + '123456' + '<?php echo $chapchallenge; ?>');
			alert(hexMD5('<?php echo $chapid; ?>' + '123456' + '<?php echo $chapchallenge; ?>'));
		}
	</script>

That gave me this data for tests (password is 123456):

	chapId: \115
	chapChallange: \274\013\242\243\236\226\151\224\070\023\243\207\252\061\016\254
        expected hash: 9d4cd928fadf971ed24c7d5d9c46cd23

But my function to recalc hash always give me wrong values. My implementation for now:

public string GetDecodedPass(string chapId, string chapChallenge, string pass)
        {
            string passAsci = $"{FromOctal(chapId)}{StringToAsciiHex(pass)}{FromOctal(chapChallenge)}";
            byte[] bytes = Encoding.ASCII.GetBytes(passAsci);
            var md5 = MD5.Create();
            var hash = md5.ComputeHash(bytes);
            return AsciBytesToHex(hash).ToLower();
        }

Where FromOctal makes char values from parts of input and convert it from octal format to ascii. StringToAsciiHex create hex formatted string.
I’m trying use not formatted chap but that doesn’t work too so i found on forum that it should be converted from octal to chars (in other programming language). At the end I format md5 to hex.

Do you know what is format/encoding input and what result should be formatted??
Any ideas what I’m doing wrong?

No one knows which response format is correct?

Use js implementation from mikrotik code.