Thank you for your reply.
As i stated, i dont want the users to be able to login to the hotspot without the permission of the external server first. a non encrypted password would ruin everything as the client could easily use it again to login. the real solution for this, is ofc RADIUS server. now i want to achieve the same thing, without RADIUS server. i already created the necessary files and was able to reproduce the correct md5 hash with php.
I also did some testing on chap-id / chap-challenge . as it was expected, they change as they should. I am almost there. i just need to put all the pieces together.
Edit: for those who might be interested, you can generate the right md5 hash in php like this:
<?php
function get_string($c)
{
$c2 = explode('\\',$c);
$c3 = array();
foreach($c2 as $cc) {
$c3[] = chr(octdec($cc));
}
$c3 = implode('',$c3);
return(substr($c3,1));
}
$pass = 'test';
$rd4md5 = get_string($_POST['chap-id']).$pass.get_string($_POST['chap-challenge']);
echo md5($rd4md5);
?>