Crypt/Math.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Crypt  
Subpackage
Math  
Version
$Id: Math.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Crypt_Math

Package: Zend\Crypt

Support for arbitrary precision mathematics in PHP.

Zend_Crypt_Math_BigInteger is a wrapper across three PHP extensions: bcmath, gmp and big_int. Since each offer similar functionality, but availability of each differs across installations of PHP, this wrapper attempts to select the fastest option available and encapsulate a subset of its functionality which all extensions share in common.

This class requires one of the three extensions to be available. BCMATH while the slowest, is available by default under Windows, and under Unix if PHP is compiled with the flag "--enable-bcmath". GMP requires the gmp library from http://www.swox.com/gmp/ and PHP compiled with the "--with-gmp" flag. BIG_INT support is available from a big_int PHP library available from only from PECL (a Windows port is not available).

Parent(s)
\Zend_Crypt_Math_BigInteger
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotected\Zend_Crypt_Math_BigInteger_Interface $_math = null
inherited

Holds an instance of one of the three arbitrary precision wrappers.

Inherited from: \Zend_Crypt_Math_BigInteger::$$_math
Default valuenullDetails
Type
\Zend_Crypt_Math_BigInteger_Interface
Inherited_from
\Zend_Crypt_Math_BigInteger::$$_math  

Methods

methodpublic__call(string $methodName, array $args) : void
inherited

Redirect all public method calls to the wrapped extension object.

Inherited from: \Zend_Crypt_Math_BigInteger::__call()
Parameters
Name Type Description
$methodName string
$args array
Throws
Exception Description
\Zend_Crypt_Math_BigInteger_Exception
methodpublic__construct(string $extension = null) : void
inherited

Constructor; a Factory which detects a suitable PHP extension for arbitrary precision math and instantiates the suitable wrapper object.

Inherited from: \Zend_Crypt_Math_BigInteger::__construct()
Parameters
Name Type Description
$extension string
Throws
Exception Description
\Zend_Crypt_Math_BigInteger_Exception
methodprotected_loadAdapter(string $extension = null) : void
Parameters
Name Type Description
$extension string
Throws
Exception Description
\Zend_Crypt_Math_BigInteger_Exception
methodpublicbtwoc(string $long) : string

Get the big endian two's complement of a given big integer in binary notation

Parameters
Name Type Description
$long string
Returns
Type Description
string
methodpublicfromBinary(string $binary) : string

Translate a binary form into a big integer string

Parameters
Name Type Description
$binary string
Returns
Type Description
string
methodpublicrand(string | int $minimum, string | int $maximum) : string

Generate a pseudorandom number within the given range.

Will attempt to read from a systems RNG if it exists or else utilises a simple random character to maximum length process. Simplicity is a factor better left for development...

Parameters
Name Type Description
$minimum string | int
$maximum string | int
Returns
Type Description
string
methodpublictoBinary(string $integer) : string

Translate a big integer string into a binary form

Parameters
Name Type Description
$integer string
Returns
Type Description
string
Documentation was generated by phpDocumentor 2.0.0a8.