backup
/
src
/
JetBackup
/
3rdparty
/
phpseclib3
/
Math
/
BigInteger
/
Engines
/
BCMath
/
BuiltIn.php
backup
/
src
/
JetBackup
/
3rdparty
/
phpseclib3
/
Math
/
BigInteger
/
Engines
/
BCMath
Last commit date
Reductions
1 year ago
.htaccess
1 year ago
Base.php
1 year ago
BuiltIn.php
1 year ago
DefaultEngine.php
1 year ago
OpenSSL.php
1 year ago
index.html
1 year ago
web.config
1 year ago
BuiltIn.php
38 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Built-In BCMath Modular Exponentiation Engine |
| 5 | * |
| 6 | * PHP version 5 and 7 |
| 7 | * |
| 8 | * @author Jim Wigginton <terrafrost@php.net> |
| 9 | * @copyright 2017 Jim Wigginton |
| 10 | * @license http://www.opensource.org/licenses/mit-license.html MIT License |
| 11 | * @link http://pear.php.net/package/Math_BigInteger |
| 12 | */ |
| 13 | |
| 14 | declare(strict_types=1); |
| 15 | |
| 16 | namespace phpseclib3\Math\BigInteger\Engines\BCMath; |
| 17 | |
| 18 | use phpseclib3\Math\BigInteger\Engines\BCMath; |
| 19 | |
| 20 | /** |
| 21 | * Built-In BCMath Modular Exponentiation Engine |
| 22 | * |
| 23 | * @author Jim Wigginton <terrafrost@php.net> |
| 24 | */ |
| 25 | abstract class BuiltIn extends BCMath |
| 26 | { |
| 27 | /** |
| 28 | * Performs modular exponentiation. |
| 29 | */ |
| 30 | protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n): BCMath |
| 31 | { |
| 32 | $temp = new BCMath(); |
| 33 | $temp->value = bcpowmod($x->value, $e->value, $n->value); |
| 34 | |
| 35 | return $x->normalize($temp); |
| 36 | } |
| 37 | } |
| 38 |