previousIntroduction (Previous) (Next) Crypt_CHAP_MD5::Crypt_CHAP_MD5()next

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Crypt_CHAP::generateChallenge()

Crypt_CHAP::generateChallenge() – Generates a new random challenge.

Synopsis

string Crypt_CHAP::generateChallenge ( string $varname = 'challenge' , int $size = 8 )

Description

This method generates a new random challenge and stores it in the given property, the default size of the challenge is 8 bytes.

Parameter

  • string $varname - name of the property for storing the challenge

  • int $size - the size of the challenge

Return value

string - a String containing the challenge

Note

This function can not be called statically.

Example

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());

?>
previousIntroduction (Previous) (Next) Crypt_CHAP_MD5::Crypt_CHAP_MD5()next

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.