Home | History | Annotate | Download | only in big

Lines Matching defs:Mod

249 // Mod sets z to the modulus x%y for y != 0 and returns z.
251 // Mod implements Euclidean modulus (unlike Go); see DivMod for more details.
252 func (z *Int) Mod(x, y *Int) *Int {
269 // DivMod sets z to the quotient x div y and m to the modulus x mod y
279 // div and mod''. ACM Transactions on Programming Languages and
405 // Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z.
406 // If y <= 0, the result is 1 mod |m|; if m == nil or m == 0, z = x**y.
427 z.abs = z.abs.sub(mWords, z.abs) // z == x**y mod |m| && 0 <= z < |m|
573 g = g2.Mod(g, n)
616 a.Mod(&a, &b)
642 // (a^((p+1)/4))^2 mod p
643 // == u^(p+1) mod p
644 // == u^2 mod p
645 // to calculate the square root of any quadratic residue mod p quickly for 3
646 // mod 4 primes.
651 z.Exp(x, z, p) // z = x^z mod p
687 t.Mul(&t, &t).Mod(&t, p)
696 // t = g^(2^(r-m-1)) mod p
697 g.Mul(&t, &t).Mod(&g, p) // g = g^(2^(r-m)) mod p
698 y.Mul(&y, &t).Mod(&y, p)
699 b.Mul(&b, &g).Mod(&b, p)
704 // ModSqrt sets z to a square root of x mod p if such a square root exists, and
705 mod p,
711 return nil // x is not a square mod p
713 return z.SetInt64(0) // sqrt(0) mod p = 0
718 x = new(Int).Mod(x, p)
721 // Check whether p is 3 mod 4, and if so, use the faster algorithm.