PHP code example of richardds / big-integer

1. Go to this page and download the library: Download richardds/big-integer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

richardds / big-integer example snippets


use Richardds\BigInteger\BigInteger;
use Richardds\BigInteger\Utils as BigIntegerUtils;

$g = BigInteger::fromInt(2);
$e = BigInteger::fromString("<big_integer>");
$m = BigInteger::fromString("<big_integer>");
$c = $g->powMod($e, $m);

$p = BigInteger::fromBuffer("<buffer>");
$z = BigInteger::fromString("<big_integer>");

$x = $g->powMod($p, $m)
       ->mul($z->sub(BigInteger::one()))
       ->mod($m);

$a = BigInteger::fromString("<big_integer>");
$b = BigInteger::fromString("<big_integer>");
$gcd = $a->gcd($b);
$gcd = BigIntegerUtils::gcd($a, $b);