string Crypt_CHAP::generateChallenge (
string $varname = 'challenge'
, int $size = 8
)
This method generates a new random challenge and stores it in the given property, the default size of the challenge is 8 bytes.
string $varname
- name of the property for storing the challenge
int $size
- the size of the challenge
string
- a String containing the challenge
This function can not be called statically.
Using Crypt_CHAP::generateChallenge()
<?php
require_once 'File/SMBPasswd.php';
$cr = new Crypt_CHAP_MD5();
echo bin2hex($cr->challenge);
// or generate a new challenge
echo bin2hex(echo $cr->generateChallenge());
?>