18 if (&g == &r || &g == &s || &r == &s)
19 throw "BigInteger extendedEuclidean: Outputs are aliased";
26 r = r1; s = s1; g = m;
31 r1 -= q*r2; s1 -= q*s2;
34 r = r2; s = s2; g =
n;
39 r2 -= q*r1; s2 -= q*s1;
48 return (r % n).getMagnitude();
50 throw "BigInteger modinv: x and n have a common factor";
55 BigUnsigned ans = 1, base2 = (base % modulus).getMagnitude();
void divideWithRemainder(const BigUnsigned &b, BigUnsigned &q)
BigUnsigned modinv(const BigInteger &x, const BigUnsigned &n)
BigUnsigned gcd(BigUnsigned a, BigUnsigned b)
NumberlikeArray< Blk >::Index Index
void extendedEuclidean(BigInteger m, BigInteger n, BigInteger &g, BigInteger &r, BigInteger &s)
BigUnsigned modexp(const BigInteger &base, const BigUnsigned &exponent, const BigUnsigned &modulus)
void divideWithRemainder(const BigInteger &b, BigInteger &q)
bool getBit(Index bi) const