Class Mod


  • public abstract class Mod
    extends java.lang.Object
    Modular inversion as implemented in this class is based on the paper "Fast constant-time gcd computation and modular inversion" by Daniel J. Bernstein and Bo-Yin Yang.

    In some cases (when it is faster) we use the "half delta" variant of safegcd based on hddivsteps.

    • Constructor Detail

      • Mod

        public Mod()
    • Method Detail

      • checkedModOddInverse

        public static void checkedModOddInverse​(int[] m,
                                                int[] x,
                                                int[] z)
      • checkedModOddInverseVar

        public static void checkedModOddInverseVar​(int[] m,
                                                   int[] x,
                                                   int[] z)
      • inverse32

        public static int inverse32​(int d)
      • modOddInverse

        public static int modOddInverse​(int[] m,
                                        int[] x,
                                        int[] z)
      • modOddInverseVar

        public static boolean modOddInverseVar​(int[] m,
                                               int[] x,
                                               int[] z)
      • modOddIsCoprime

        public static int modOddIsCoprime​(int[] m,
                                          int[] x)
      • modOddIsCoprimeVar

        public static boolean modOddIsCoprimeVar​(int[] m,
                                                 int[] x)
      • random

        public static int[] random​(int[] p)