ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_OpenID_BcMathWrapper Class Reference
+ Inheritance diagram for Auth_OpenID_BcMathWrapper:
+ Collaboration diagram for Auth_OpenID_BcMathWrapper:

Public Member Functions

 add ($x, $y)
 
 sub ($x, $y)
 
 pow ($base, $exponent)
 
 cmp ($x, $y)
 
 init ($number, $base=10)
 
 mod ($base, $modulus)
 
 mul ($x, $y)
 
 div ($x, $y)
 
 _powmod ($base, $exponent, $modulus)
 Same as bcpowmod when bcpowmod is missing. More...
 
 powmod ($base, $exponent, $modulus)
 
 toString ($num)
 
- Public Member Functions inherited from Auth_OpenID_MathLibrary
 longToBinary ($long)
 Given a long integer, returns the number converted to a binary string. More...
 
 binaryToLong ($str)
 Given a binary string, returns the binary string converted to a long number. More...
 
 base64ToLong ($str)
 
 longToBase64 ($str)
 
 rand ($stop)
 Returns a random number in the specified range. More...
 

Data Fields

 $type = 'bcmath'
 

Detailed Description

Definition at line 190 of file BigMath.php.

Member Function Documentation

◆ _powmod()

Auth_OpenID_BcMathWrapper::_powmod (   $base,
  $exponent,
  $modulus 
)

Same as bcpowmod when bcpowmod is missing.

@access private

Definition at line 238 of file BigMath.php.

239 {
240 $square = $this->mod($base, $modulus);
241 $result = 1;
242 while($this->cmp($exponent, 0) > 0) {
243 if ($this->mod($exponent, 2)) {
244 $result = $this->mod($this->mul($result, $square), $modulus);
245 }
246 $square = $this->mod($this->mul($square, $square), $modulus);
247 $exponent = $this->div($exponent, 2);
248 }
249 return $result;
250 }
$result
mod($base, $modulus)
Definition: BigMath.php:218

References $result, cmp(), div(), mod(), and mul().

Referenced by powmod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add()

Auth_OpenID_BcMathWrapper::add (   $x,
  $y 
)

Definition at line 193 of file BigMath.php.

194 {
195 return bcadd($x, $y);
196 }
$y
Definition: example_007.php:83
$x
Definition: example_009.php:98

References $x, and $y.

◆ cmp()

Auth_OpenID_BcMathWrapper::cmp (   $x,
  $y 
)

Definition at line 208 of file BigMath.php.

209 {
210 return bccomp($x, $y);
211 }

References $x, and $y.

Referenced by _powmod().

+ Here is the caller graph for this function:

◆ div()

Auth_OpenID_BcMathWrapper::div (   $x,
  $y 
)

Definition at line 228 of file BigMath.php.

229 {
230 return bcdiv($x, $y);
231 }

References $x, and $y.

Referenced by _powmod().

+ Here is the caller graph for this function:

◆ init()

Auth_OpenID_BcMathWrapper::init (   $number,
  $base = 10 
)

Definition at line 213 of file BigMath.php.

214 {
215 return $number;
216 }

◆ mod()

Auth_OpenID_BcMathWrapper::mod (   $base,
  $modulus 
)

Definition at line 218 of file BigMath.php.

219 {
220 return bcmod($base, $modulus);
221 }

Referenced by _powmod().

+ Here is the caller graph for this function:

◆ mul()

Auth_OpenID_BcMathWrapper::mul (   $x,
  $y 
)

Definition at line 223 of file BigMath.php.

224 {
225 return bcmul($x, $y);
226 }

References $x, and $y.

Referenced by _powmod().

+ Here is the caller graph for this function:

◆ pow()

Auth_OpenID_BcMathWrapper::pow (   $base,
  $exponent 
)

Definition at line 203 of file BigMath.php.

204 {
205 return bcpow($base, $exponent);
206 }

◆ powmod()

Auth_OpenID_BcMathWrapper::powmod (   $base,
  $exponent,
  $modulus 
)

Definition at line 252 of file BigMath.php.

253 {
254 if (function_exists('bcpowmod')) {
255 return bcpowmod($base, $exponent, $modulus);
256 } else {
257 return $this->_powmod($base, $exponent, $modulus);
258 }
259 }
_powmod($base, $exponent, $modulus)
Same as bcpowmod when bcpowmod is missing.
Definition: BigMath.php:238

References _powmod().

+ Here is the call graph for this function:

◆ sub()

Auth_OpenID_BcMathWrapper::sub (   $x,
  $y 
)

Definition at line 198 of file BigMath.php.

199 {
200 return bcsub($x, $y);
201 }

References $x, and $y.

◆ toString()

Auth_OpenID_BcMathWrapper::toString (   $num)

Definition at line 261 of file BigMath.php.

262 {
263 return $num;
264 }

Field Documentation

◆ $type

Auth_OpenID_BcMathWrapper::$type = 'bcmath'

Definition at line 191 of file BigMath.php.


The documentation for this class was generated from the following file: