PHP chap function

The scope of the project is to create a function that receive following parameters.




The function must return true if password matches, false if not.

ChapPassword and ChapChallenge are both buffers so they will be provided as a string where values are separated by a ":".

An example of provided chap-password and chap-challenge will be provided.

This is a working example written in "C"

int chap_valid(char* pass)
{ int i; unsigned char* chap; unsigned char chapid;
if (chap=(unsigned char*)getpar("CHAP-Password"))
{ unsigned char *chal;
chapid=chap[0]; chap=&chap[1];
if ((chal=(unsigned char*)getpar("CHAP-Challenge"))==NULL) chal=RA;
//Ora ho chap, chal e chapid
char tomd[33]; //Provo ID + pass + chal, con o senza offset
for(i=16; i<33; i++) tomd[i]=0;

strcpy(&tomd[1], pass);
for (i=0; i<16; i++) tomd[i+strlen(pass)+1]=chal[i];

char res[33]; char openchap[33];
md5sum((unsigned char*)(tomd), 17+strlen(pass), res);
for (i=0; i<16; i++) { sprintf(&openchap[i*2], "%02x", chap[i]);
if (!strcasecmp(openchap,res)) return 1;
return 0;

getpar return values that we will pass as parameters.
RA is a value that we will pass, in the php function, as chap-challenge in any case.

Here an example of a received request
PlainPassword: 150572
chap-password: 242:239:25:8:195:116:254:247:244:110:193:109:8:170:15:132:35
challenge: 32:32:32:32:32:32:49:52:49:51:51:57:53:51:50:52

Values arrives on the php as a string with ascii values delimited by ":", but the password must be compared as a string. Each value between : is the numerical rappresentation of a char.

Habilidades: PHP

Ver más: php create function, php challenge, string function, receive function, password function, php password function, php cut string characters, php smarty string concatenation, php values calculator, php compress string, php mysql string break, php range string, function updateprice php, function password, function elapsedtime php, function datediff php

Información del empleador:
( 46 comentarios ) Cagli, Italy

Nº del proyecto: #6591135

13 freelancers están ofertando el promedio de €18 para este trabajo


Dear Employer, Greetings, I would be happy to work on your website, I can assure 100% satisfaction for quality work. I am expert in web programming. Please feel free to ask any questions. Looking forwar Más

€24 EUR en 1 día
(170 comentarios)

Hello Hiring Manager, Greetings of the day! I’m a Web Developer from India who is specialized in WP,Bootstrap,Theme/Plugin Customization,Responsive Design,HTML5,CSS3,JS,Jquery,Hosting,GIT,Server Config. and Más

€10 EUR en 1 día
(12 comentarios)

Hi I'm PHP / MySQL developer, 10 years of experience, I would be very happy to make your script, I am available to do the nows.

€18 EUR en 0 días
(51 comentarios)

Hello, Given the description, this project sounds straightforward, and I should be able to finish it immediately. I am available right now for work. Can you give me the example? Thank you, and I look forward f Más

€11 EUR en 0 días
(53 comentarios)

Hello, Please provide me the example chap-password and chap-challenge to write the function. Best Regards, Constantin Plaiasu

€14 EUR en 1 día
(41 comentarios)

Hello, I am 4+ years of experienced developer and i can help you to create a function for password matching with the chap-password and chap-challenge but you need to provide the example to develop it. Thanks, Wa Más

€25 EUR en 1 día
(32 comentarios)

Hello, do you want this function inside a class or just a plain php script ? Can you give a n example on the chap ?

€23 EUR en 1 día
(56 comentarios)

ok, i can do it. I read the requirement. I am online. Looking forward from you.......................................... Thanks

€30 EUR en 1 día
(4 comentarios)

I have a lot of experience with PHP functions, i can doing this job for less then a half hour, expect cooperation, regards, Alex.

€15 EUR en 1 día
(21 comentarios)

Hi sir, Let’s discuss, so that we could analyze your project in detail. ***As freelancer.com has restricted the option of following up with the Employer initially, we cannot do the same until and unless you init Más

€23 EUR en 1 día
(0 comentarios)

I will deliver you this function within an hour with free revisions untill you are satisfied with the job.

€24 EUR en 1 día
(0 comentarios)

hi , im a PHP Developer nd i have done many PHP project outside the freelancer.com if you want se emy past work plz let me know i wil show you i hae read your project description so kindly send me the example of Ch Más

€10 EUR en 2 días
(0 comentarios)

Hello, I am willing to help you. Sounds simple enough. Give me all details and I'll start work as soon as possible. Cheers, Nick

€13 EUR en 1 día
(0 comentarios)