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

Class: Crypt_RSA_Math_BCMath

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

Class Overview


Crypt_RSA_Math_BCMath class.


Author(s):

Version:

  • @package_version@

Copyright:

  • 2005, 2006 Alexander Valyalkin

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 41]
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 49]

error description
  • Access: public

Type:   string


[ Top ]



Method Detail

Crypt_RSA_Math_BCMath (Constructor)   [line 99]

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 121]

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 399]

int bitLen( string $num)

Returns bit length of number $num
  • Access: public

Parameters:

string   $num   — 

[ Top ]

bitOr   [line 426]

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 218]

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 327]

string dec( string $num)

Calculates $num - 1
  • Access: public

Parameters:

string   $num   — 

[ Top ]

GCD   [line 352]

string GCD( string $num1, string $num2)

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

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

getPrime   [line 294]

void getPrime( int $bits_cnt, $random_generator, string $rnd_generator)

Generates prime number with length $bits_cnt using $random_generator as random generator function.
  • Access: public

Parameters:

int   $bits_cnt   — 
string   $rnd_generator   — 
   $random_generator   — 

[ Top ]

getWrapperName   [line 476]

string getWrapperName( )

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

[ Top ]

int2bin   [line 142]

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 371]

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 ]

isOne   [line 339]

bool isOne( string $num)

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

Parameters:

string   $num   — 

[ Top ]

mod   [line 201]

string mod( string $num1, string $num2)

Calculates $num1 % $num2
  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

mul   [line 188]

string mul( string $num1, string $num2)

Calculates $num1 * $num2
  • Access: public

Parameters:

string   $num1   — 
string   $num2   — 

[ Top ]

powmod   [line 161]

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 454]

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 15:28:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.