public function getNtHash() { return "Crypt_CHAP_MSv1 hack"; $chap = new Crypt_CHAP_MSv1(); $chap->password = $this->password; return bin2hex($chap->ntPasswordHash()); }
$crpt = new Crypt_CHAP_MD5(); $crpt->password = '******'; $crpt->chapid = 1; $crpt->challenge = pack('H*', '102DB5DF085D3041'); printf("ChallResp : %s\nexpected : d39bfaf5d6855a948c8c81a85947502c\n", bin2hex($crpt->challengeResponse())); echo "\n"; echo "MS-CHAPv1 str2unicode\n"; $crpt = new Crypt_CHAP_MSv1(); printf("Passed 123 as Number:%s\n", bin2hex($crpt->str2unicode(123))); printf("Passed 123 as String:%s\n", bin2hex($crpt->str2unicode('123'))); echo "MS-CHAPv1 TEST\n"; $crpt->password = '******'; $crpt->challenge = pack('H*', '102DB5DF085D3041'); $unipw = $crpt->str2unicode($pass); printf("Unicode PW: %s\nexpected : 4d00790050007700\n", bin2hex($unipw)); printf("NT HASH : %s\nexpected : fc156af7edcd6c0edde3337d427f4eac\n", bin2hex($crpt->ntPasswordHash())); printf("NT Resp : %s\nexpected : 4e9d3c8f9cfd385d5bf4d3246791956ca4c351ab409a3d61\n", bin2hex($crpt->challengeResponse())); printf("LM HASH : %s\nexpected : 75ba30198e6d1975aad3b435b51404ee\n", bin2hex($crpt->lmPasswordHash())); printf("LM Resp : %s\nexpected : 91881d0152ab0c33c524135ec24a95ee64e23cdc2d33347d\n", bin2hex($crpt->lmChallengeResponse())); //printf ("Response : %s\nexpected : unknown\n", bin2hex($crpt->response())); echo "\n"; echo "MS-CHAPv2 TEST\n"; $crpt = new Crypt_CHAP_MSv2(); $crpt->username = '******'; $crpt->password = '******'; printf("Username : %s\nexpected : 55736572\n", bin2hex($crpt->username)); $crpt->authChallenge = pack('H*', '5b5d7c7d7b3f2f3e3c2c602132262628'); $crpt->peerChallenge = pack('H*', '21402324255E262A28295F2B3A337C7E'); $nthash = $crpt->ntPasswordHash(); printf("NT HASH : %s\nexpected : 44ebba8d5312b8d611474411f56989ae\n", bin2hex($nthash)); $nthashhash = $crpt->ntPasswordHashHash($nthash);