Example #1
0
 public static void AddOne(uint[] x, uint[] z)
 {
     if (Nat.Inc(6, x, z) != 0 || (z[5] == uint.MaxValue && Nat192.Gte(z, P)))
     {
         Nat.Add33To(6, 4553u, z);
     }
 }
Example #2
0
 public static void Add(uint[] x, uint[] y, uint[] z)
 {
     if (Nat192.Add(x, y, z) != 0 || (z[5] == 4294967295u && Nat192.Gte(z, P)))
     {
         Nat.Add33To(6, 4553u, z);
     }
 }
Example #3
0
 public static void Twice(uint[] x, uint[] z)
 {
     if (Nat.ShiftUpBit(6, x, 0u, z) != 0 || (z[5] == uint.MaxValue && Nat192.Gte(z, P)))
     {
         Nat.Add33To(6, 4553u, z);
     }
 }
Example #4
0
 public static void Twice(uint[] x, uint[] z)
 {
     if ((Nat.ShiftUpBit(6, x, 0, z) != 0) || ((z[5] == uint.MaxValue) && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
Example #5
0
 public static void Twice(uint[] x, uint[] z)
 {
     if (Nat.ShiftUpBit(6, x, 0u, z) != 0u || (z[5] == 4294967295u && Nat192.Gte(z, SecP192R1Field.P)))
     {
         SecP192R1Field.AddPInvTo(z);
     }
 }
Example #6
0
 public static void AddOne(uint[] x, uint[] z)
 {
     if ((Nat.Inc(6, x, z) != 0) || ((z[5] == uint.MaxValue) && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
 public static void AddOne(uint[] x, uint[] z)
 {
     if ((Nat.Inc(6, x, z) != 0) || ((z[5] == uint.MaxValue) && Nat192.Gte(z, P)))
     {
         Nat.Add33To(6, 0x11c9, z);
     }
 }
        public static void Reduce32(uint x, uint[] z)
        {
            ulong cc = 0;

            if (x != 0)
            {
                cc  += (ulong)z[0] + x;
                z[0] = (uint)cc;
                cc >>= 32;
                if (cc != 0)
                {
                    cc  += (ulong)z[1];
                    z[1] = (uint)cc;
                    cc >>= 32;
                }
                cc  += (ulong)z[2] + x;
                z[2] = (uint)cc;
                cc >>= 32;

                Debug.Assert(cc == 0 || cc == 1);
            }

            if ((cc != 0 && Nat.IncAt(6, z, 3) != 0) ||
                (z[5] == P5 && Nat192.Gte(z, P)))
            {
                AddPInvTo(z);
            }
        }
Example #9
0
 public static void Twice(uint[] x, uint[] z)
 {
     if (Nat.ShiftUpBit(6, x, 0u, z) != 0 || (z[5] == 4294967295u && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
Example #10
0
 public static void Add(uint[] x, uint[] y, uint[] z)
 {
     if (Nat192.Add(x, y, z) != 0 || (z[5] == 4294967295u && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
Example #11
0
 public static void AddOne(uint[] x, uint[] z)
 {
     if (Nat.Inc(6, x, z) != 0 || (z[5] == 4294967295u && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
Example #12
0
 public static void AddOne(uint[] x, uint[] z)
 {
     if (Nat.Inc(6, x, z) != 0u || (z[5] == 4294967295u && Nat192.Gte(z, SecP192K1Field.P)))
     {
         Nat.Add33To(6, 4553u, z);
     }
 }
Example #13
0
 public static void Twice(uint[] x, uint[] z)
 {
     if (Nat.ShiftUpBit(6, x, 0u, z) != 0u || (z[5] == 4294967295u && Nat192.Gte(z, SecP192K1Field.P)))
     {
         Nat.Add33To(6, 4553u, z);
     }
 }
Example #14
0
 public static void Add(uint[] x, uint[] y, uint[] z)
 {
     if ((Nat192.Add(x, y, z) != 0) || ((z[5] == uint.MaxValue) && Nat192.Gte(z, P)))
     {
         AddPInvTo(z);
     }
 }
Example #15
0
 public static void AddOne(uint[] x, uint[] z)
 {
     if (Nat.Inc(6, x, z) != 0u || (z[5] == 4294967295u && Nat192.Gte(z, SecP192R1Field.P)))
     {
         SecP192R1Field.AddPInvTo(z);
     }
 }
Example #16
0
 public static void Reduce32(uint x, uint[] z)
 {
     if ((x != 0 && Nat192.Mul33WordAdd(PInv33, x, z, 0) != 0) ||
         (z[5] == P5 && Nat192.Gte(z, P)))
     {
         Nat.Add33To(6, PInv33, z);
     }
 }
Example #17
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] array = Nat192.FromBigInteger(x);
     if (array[5] == 4294967295u && Nat192.Gte(array, P))
     {
         Nat192.SubFrom(P, array);
     }
     return(array);
 }
Example #18
0
        public static void Add(uint[] x, uint[] y, uint[] z)
        {
            uint c = Nat192.Add(x, y, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                Nat192.AddDWord(PInv, z, 0);
            }
        }
Example #19
0
        public static void Twice(uint[] x, uint[] z)
        {
            uint c = Nat192.ShiftUpBit(x, 0, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                Nat192.AddDWord(PInv, z, 0);
            }
        }
Example #20
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] z = Nat192.FromBigInteger(x);
     if (z[5] == P5 && Nat192.Gte(z, P))
     {
         Nat192.SubFrom(P, z);
     }
     return(z);
 }
Example #21
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] z = Nat192.FromBigInteger(x);
     if (z[5] == P5 && Nat192.Gte(z, P))
     {
         Nat192.AddDWord(PInv, z, 0);
     }
     return(z);
 }
Example #22
0
        public static void AddOne(uint[] x, uint[] z)
        {
            uint c = Nat.Inc(6, x, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                AddPInvTo(z);
            }
        }
Example #23
0
        public static void Twice(uint[] x, uint[] z)
        {
            uint c = Nat.ShiftUpBit(6, x, 0, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                AddPInvTo(z);
            }
        }
Example #24
0
        public static void Add(uint[] x, uint[] y, uint[] z)
        {
            uint c = Nat192.Add(x, y, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                AddPInvTo(z);
            }
        }
Example #25
0
        public static void Reduce32(uint x, uint[] z)
        {
            uint c = Nat192.AddWord(x, z, 0) + Nat192.AddWord(x, z, 2);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                Nat192.Sub(z, P, z);
            }
        }
Example #26
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] array = Nat192.FromBigInteger(x);
     if (array[5] == uint.MaxValue && Nat192.Gte(array, P))
     {
         Nat192.SubFrom(P, array);
     }
     return(array);
 }
Example #27
0
        public static void Twice(uint[] x, uint[] z)
        {
            uint c = Nat192.ShiftUpBit(x, 0, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                Nat192.Sub(z, P, z);
            }
        }
Example #28
0
        public static void Reduce(uint[] xx, uint[] z)
        {
            ulong y = Nat192.Mul33Add(4553u, xx, 6, xx, 0, z, 0);

            if (Nat192.Mul33DWordAdd(4553u, y, z, 0) != 0 || (z[5] == 4294967295u && Nat192.Gte(z, P)))
            {
                Nat.Add33To(6, 4553u, z);
            }
        }
Example #29
0
 public static uint[] FromBigInteger(BigInteger x)
 {
     uint[] numArray = Nat192.FromBigInteger(x);
     if ((numArray[5] == uint.MaxValue) && Nat192.Gte(numArray, P))
     {
         Nat192.SubFrom(P, numArray);
     }
     return(numArray);
 }
Example #30
0
        public static void Add(uint[] x, uint[] y, uint[] z)
        {
            uint c = Nat192.Add(x, y, z);

            if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P)))
            {
                Nat.Add33To(6, PInv33, z);
            }
        }