Ejemplo n.º 1
0
 public static void Invert(ulong[] x, ulong[] z)
 {
     //IL_0008: Unknown result type (might be due to invalid IL or missing references)
     if (Nat128.IsZero64(x))
     {
         throw new InvalidOperationException();
     }
     ulong[] array  = Nat128.Create64();
     ulong[] array2 = Nat128.Create64();
     Square(x, array);
     Multiply(array, x, array);
     Square(array, array);
     Multiply(array, x, array);
     SquareN(array, 3, array2);
     Multiply(array2, array, array2);
     Square(array2, array2);
     Multiply(array2, x, array2);
     SquareN(array2, 7, array);
     Multiply(array, array2, array);
     SquareN(array, 14, array2);
     Multiply(array2, array, array2);
     SquareN(array2, 28, array);
     Multiply(array, array2, array);
     SquareN(array, 56, array2);
     Multiply(array2, array, array2);
     Square(array2, z);
 }
Ejemplo n.º 2
0
        public static void Invert(ulong[] x, ulong[] z)
        {
            if (Nat128.IsZero64(x))
            {
                throw new InvalidOperationException();
            }

            // Itoh-Tsujii inversion

            ulong[] t0 = Nat128.Create64();
            ulong[] t1 = Nat128.Create64();

            Square(x, t0);
            Multiply(t0, x, t0);
            Square(t0, t0);
            Multiply(t0, x, t0);
            SquareN(t0, 3, t1);
            Multiply(t1, t0, t1);
            Square(t1, t1);
            Multiply(t1, x, t1);
            SquareN(t1, 7, t0);
            Multiply(t0, t1, t0);
            SquareN(t0, 14, t1);
            Multiply(t1, t0, t1);
            SquareN(t1, 28, t0);
            Multiply(t0, t1, t0);
            SquareN(t0, 56, t1);
            Multiply(t1, t0, t1);
            Square(t1, z);
        }
Ejemplo n.º 3
0
 public static void Invert(ulong[] x, ulong[] z)
 {
     if (Nat128.IsZero64(x))
     {
         throw new InvalidOperationException();
     }
     ulong[] numArray  = Nat128.Create64();
     ulong[] numArray2 = Nat128.Create64();
     Square(x, numArray);
     Multiply(numArray, x, numArray);
     Square(numArray, numArray);
     Multiply(numArray, x, numArray);
     SquareN(numArray, 3, numArray2);
     Multiply(numArray2, numArray, numArray2);
     Square(numArray2, numArray2);
     Multiply(numArray2, x, numArray2);
     SquareN(numArray2, 7, numArray);
     Multiply(numArray, numArray2, numArray);
     SquareN(numArray, 14, numArray2);
     Multiply(numArray2, numArray, numArray2);
     SquareN(numArray2, 0x1c, numArray);
     Multiply(numArray, numArray2, numArray);
     SquareN(numArray, 0x38, numArray2);
     Multiply(numArray2, numArray, numArray2);
     Square(numArray2, z);
 }