!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/   drwxr-xr-x
Free 13.33 GB of 57.97 GB (23%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Montgomery.php (4.6 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/**
 * PHP Montgomery Modular Exponentiation Engine
 *
 * PHP version 5 and 7
 *
 * @category  Math
 * @package   BigInteger
 * @author    Jim Wigginton <terrafrost@php.net>
 * @copyright 2017 Jim Wigginton
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
 * @link      http://pear.php.net/package/Math_BigInteger
 */

namespace phpseclib3\Math\BigInteger\Engines\PHP\Reductions;

use 
phpseclib3\Math\BigInteger\Engines\PHP\Montgomery as Progenitor;

/**
 * PHP Montgomery Modular Exponentiation Engine
 *
 * @package PHP
 * @author  Jim Wigginton <terrafrost@php.net>
 * @access  public
 */
abstract class Montgomery extends Progenitor
{
    
/**
     * Prepare a number for use in Montgomery Modular Reductions
     *
     * @param array $x
     * @param array $n
     * @param string $class
     * @return array
     */
    
protected static function prepareReduce(array $x, array $n$class)
    {
        
$lhs = new $class();
        
$lhs->value array_merge(self::array_repeat(0count($n)), $x);
        
$rhs = new $class();
        
$rhs->value $n;

        list(, 
$temp) = $lhs->divide($rhs);
        return 
$temp->value;
    }

    
/**
     * Montgomery Multiply
     *
     * Interleaves the montgomery reduction and long multiplication algorithms together as described in
     * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36}
     *
     * @param array $x
     * @param array $n
     * @param string $class
     * @return array
     */
    
protected static function reduce(array $x, array $n$class)
    {
        static 
$cache = [
            
self::VARIABLE => [],
            
self::DATA => []
        ];

        if ((
$key array_search($n$cache[self::VARIABLE])) === false) {
            
$key count($cache[self::VARIABLE]);
            
$cache[self::VARIABLE][] = $x;
            
$cache[self::DATA][] = self::modInverse67108864($n$class);
        }

        
$k count($n);

        
$result = [self::VALUE => $x];

        for (
$i 0$i $k; ++$i) {
            
$temp $result[self::VALUE][$i] * $cache[self::DATA][$key];
            
$temp $temp $class::BASE_FULL * ($class::BASE === 26 intval($temp 0x4000000) : ($temp >> 31));
            
$temp $class::regularMultiply([$temp], $n);
            
$temp array_merge(self::array_repeat(0$i), $temp);
            
$result $class::addHelper($result[self::VALUE], false$tempfalse);
        }

        
$result[self::VALUE] = array_slice($result[self::VALUE], $k);

        if (
self::compareHelper($resultfalse$nfalse) >= 0) {
            
$result $class::subtractHelper($result[self::VALUE], false$nfalse);
        }

        return 
$result[self::VALUE];
    }

    
/**
     * Modular Inverse of a number mod 2**26 (eg. 67108864)
     *
     * Based off of the bnpInvDigit function implemented and justified in the following URL:
     *
     * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js}
     *
     * The following URL provides more info:
     *
     * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85}
     *
     * As for why we do all the bitmasking...  strange things can happen when converting from floats to ints. For
     * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields
     * int(-2147483648).  To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't
     * auto-converted to floats.  The outermost bitmask is present because without it, there's no guarantee that
     * the "residue" returned would be the so-called "common residue".  We use fmod, in the last step, because the
     * maximum possible $x is 26 bits and the maximum $result is 16 bits.  Thus, we have to be able to handle up to
     * 40 bits, which only 64-bit floating points will support.
     *
     * Thanks to Pedro Gimeno Fortea for input!
     *
     * @param array $x
     * @param string $class
     * @return int
     */
    
protected static function modInverse67108864(array $x$class// 2**26 == 67,108,864
    
{
        
$x = -$x[0];
        
$result $x 0x3// x**-1 mod 2**2
        
$result = ($result * ($x $result)) & 0xF// x**-1 mod 2**4
        
$result = ($result * (- ($x 0xFF) * $result))  & 0xFF// x**-1 mod 2**8
        
$result = ($result * ((- ($x 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF// x**-1 mod 2**16
        
$result $class::BASE == 26 ?
            
fmod($result * (fmod($x $result$class::BASE_FULL)), $class::BASE_FULL) : // x**-1 mod 2**26
            
($result * (- ($x $result) % $class::BASE_FULL)) % $class::BASE_FULL;
        return 
$result $class::MAX_DIGIT;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0069 ]--