Subversion Repositories oidplus

Rev

Rev 846 | Rev 1042 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 874
Line 3... Line 3...
3
/**
3
/**
4
 * Pure-PHP BigInteger Engine
4
 * Pure-PHP BigInteger Engine
5
 *
5
 *
6
 * PHP version 5 and 7
6
 * PHP version 5 and 7
7
 *
7
 *
-
 
8
 * @category  Math
-
 
9
 * @package   BigInteger
8
 * @author    Jim Wigginton <terrafrost@php.net>
10
 * @author    Jim Wigginton <terrafrost@php.net>
9
 * @copyright 2017 Jim Wigginton
11
 * @copyright 2017 Jim Wigginton
10
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
12
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
11
 * @link      http://pear.php.net/package/Math_BigInteger
13
 * @link      http://pear.php.net/package/Math_BigInteger
12
 */
14
 */
Line 17... Line 19...
17
use phpseclib3\Exception\BadConfigurationException;
19
use phpseclib3\Exception\BadConfigurationException;
18
 
20
 
19
/**
21
/**
20
 * Pure-PHP Engine.
22
 * Pure-PHP Engine.
21
 *
23
 *
-
 
24
 * @package PHP
22
 * @author  Jim Wigginton <terrafrost@php.net>
25
 * @author  Jim Wigginton <terrafrost@php.net>
-
 
26
 * @access  public
23
 */
27
 */
24
abstract class PHP extends Engine
28
abstract class PHP extends Engine
25
{
29
{
26
    /**#@+
30
    /**#@+
27
     * Array constants
31
     * Array constants
28
     *
32
     *
29
     * Rather than create a thousands and thousands of new BigInteger objects in repeated function calls to add() and
33
     * Rather than create a thousands and thousands of new BigInteger objects in repeated function calls to add() and
30
     * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them.
34
     * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them.
31
     *
35
     *
-
 
36
     * @access protected
32
     */
37
     */
33
    /**
38
    /**
34
     * $result[self::VALUE] contains the value.
39
     * $result[self::VALUE] contains the value.
35
     */
40
     */
36
    const VALUE = 0;
41
    const VALUE = 0;
Line 43... Line 48...
43
    /**
48
    /**
44
     * Karatsuba Cutoff
49
     * Karatsuba Cutoff
45
     *
50
     *
46
     * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication?
51
     * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication?
47
     *
52
     *
-
 
53
     * @access private
48
     */
54
     */
49
    const KARATSUBA_CUTOFF = 25;
55
    const KARATSUBA_CUTOFF = 25;
50
 
56
 
51
    /**
57
    /**
52
     * Can Bitwise operations be done fast?
58
     * Can Bitwise operations be done fast?
53
     *
59
     *
54
     * @see parent::bitwise_leftRotate()
60
     * @see parent::bitwise_leftRotate()
55
     * @see parent::bitwise_rightRotate()
61
     * @see parent::bitwise_rightRotate()
-
 
62
     * @access protected
56
     */
63
     */
57
    const FAST_BITWISE = true;
64
    const FAST_BITWISE = true;
58
 
65
 
59
    /**
66
    /**
60
     * Engine Directory
67
     * Engine Directory
61
     *
68
     *
62
     * @see parent::setModExpEngine
69
     * @see parent::setModExpEngine
-
 
70
     * @access protected
63
     */
71
     */
64
    const ENGINE_DIR = 'PHP';
72
    const ENGINE_DIR = 'PHP';
65
 
73
 
66
    /**
74
    /**
67
     * Default constructor
75
     * Default constructor