Crypt_RSA
[ class tree: Crypt_RSA ] [ index: Crypt_RSA ] [ all elements ]

Class: Crypt_RSA_Math_BCMath

Source Location: /Crypt_RSA-1.0.0/RSA/Math/BCMath.php

Class Overview


Crypt_RSA_Math_BCMath class.


Author(s):

Version:

  • @package_version@

Copyright:

  • 2005 Alexander Valyalkin

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 43]
Crypt_RSA_Math_BCMath class.

Provides set of math functions, which are used by Crypt_RSA package This class is a wrapper for PHP BCMath extension. See http://php.net/manual/en/ref.bc.php for details.



[ Top ]


Class Variables

$errstr =  ''

[line 51]

error description
  • Access: public

Type:   string


[ Top ]



Method Detail

Crypt_RSA_Math_BCMath (Constructor)   [line 164]

Crypt_RSA_Math_BCMath Crypt_RSA_Math_BCMath( )

Crypt_RSA_Math_BCMath constructor.

Checks an existance of PHP BCMath extension. On failure saves error description in $this->errstr

  • Access: public

[ Top ]

bin2int   [line 186]

string bin2int( string $str)

Transforms binary representation of large integer into its native form.

Example of transformation: $str = "\x12\x34\x56\x78\x90"; $num = 0x9078563412;

  • Access: public

Parameters:

string   $str   — 

[ Top ]

bitLen   [line 395]

int bitLen( string $num)

Returns bit length of number $num
  • Access: public

Parameters:

string   $num   — 

[ Top ]

bitOr   [line 421]

string bitOr( string $num1, string $num2, int $start_pos)

Calculates bitwise or of $num1 and $num2, starting from bit $start_pos for number $num1
  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 
int   $start_pos   — 

[ Top ]

cmpAbs   [line 270]

int cmpAbs( string $num1, string $num2)

Compares abs($num1) to abs($num2).

Returns: -1, if abs($num1) < abs($num2) 0, if abs($num1) == abs($num2) 1, if abs($num1) > abs($num2)

  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

dec   [line 323]

string dec( string $num)

Calculates $num - 1
  • Access: public

Parameters:

string   $num   — 

[ Top ]

gcd   [line 348]

string gcd( string $num1, string $num2)

Finds greatest common divider (GCD) of $num1 and $num2
  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

getRand   [line 304]

string getRand( int $bits_cnt, $random_generator, [ $is_set_higher_bit = false], string $rnd_generator)

Generates random number wich bit length $bits_cnt, using $random_generator as random generator function.

If is_set_higher_bit != false, then higer bit of result will be set to 1.

  • Access: public

Parameters:

int   $bits_cnt   — 
string   $rnd_generator   — 
   $random_generator   — 
   $is_set_higher_bit   — 

[ Top ]

getWrapperName   [line 470]

string getWrapperName( )

Returns name of current wrapper
  • Return: name of current wrapper
  • Access: public

[ Top ]

int2bin   [line 207]

string int2bin( string $num)

Transforms large integer into binary representation.

Example of transformation: $num = 0x9078563412; $str = "\x12\x34\x56\x78\x90";

  • Access: public

Parameters:

string   $num   — 

[ Top ]

invmod   [line 367]

string invmod( string $num, string $mod)

Finds inverse number $inv for $num by modulus $mod, such as: $inv * $num = 1 (mod $mod)
  • Access: public

Parameters:

string   $num   — 
string   $mod   — 

[ Top ]

isZero   [line 335]

bool isZero( string $num)

Returns true, if $num is equal to zero. Else returns false
  • Access: public

Parameters:

string   $num   — 

[ Top ]

mul   [line 253]

string mul( string $num1, string $num2)

Calculates $num1 * $num2
  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

nextPrime   [line 282]

string nextPrime( string $num)

Finds next strong pseudoprime number, following after $num
  • Access: public

Parameters:

string   $num   — 

[ Top ]

powmod   [line 226]

string powmod( string $num, string $pow, string $mod)

Calculates pow($num, $pow) (mod $mod)
  • Access: public

Parameters:

string   $num   — 
string   $pow   — 
string   $mod   — 

[ Top ]

subint   [line 448]

string subint( string $num, int $start, int $length)

Returns part of number $num, starting at bit position $start with length $length
  • Access: public

Parameters:

string   $num   — 
int   $start   —  start
int   $length   —  length

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:20:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.