Debian Codegraph @

lib/3rdParty/composer/web-token/jwt-library/Core/Util/Ecc/ModularArithmetic.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Jose\Component\Core\Util\Ecc;
6
7 use Brick\Math\BigInteger;
8
9 /**
10 * @internal
11 */
12 final class ModularArithmetic
13 {
14 public static function sub(BigInteger $minuend, BigInteger $subtrahend, BigInteger $modulus): BigInteger
15 {
16 return $minuend->minus($subtrahend)
17 ->mod($modulus);
18 }
19
20 public static function mul(BigInteger $multiplier, BigInteger $muliplicand, BigInteger $modulus): BigInteger
21 {
22 return $multiplier->multipliedBy($muliplicand)
23 ->mod($modulus);
24 }
25
26 public static function div(BigInteger $dividend, BigInteger $divisor, BigInteger $modulus): BigInteger
27 {
28 return self::mul($dividend, Math::inverseMod($divisor, $modulus), $modulus);
29 }
30 }