コード例 #1
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);
     }
 }
コード例 #2
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);
     }
 }
コード例 #3
0
        public static void Reduce(uint[] xx, uint[] z)
        {
            ulong num  = (ulong)xx[6];
            ulong num2 = (ulong)xx[7];
            ulong num3 = (ulong)xx[8];
            ulong num4 = (ulong)xx[9];
            ulong num5 = (ulong)xx[10];
            ulong num6 = (ulong)xx[11];
            ulong num7 = num + num5;
            ulong num8 = num2 + num6;
            ulong num9 = 0uL;

            num9 += (ulong)xx[0] + num7;
            uint num10 = (uint)num9;

            num9 >>= 32;
            num9  += (ulong)xx[1] + num8;
            z[1]   = (uint)num9;
            num9 >>= 32;
            num7  += num3;
            num8  += num4;
            num9  += (ulong)xx[2] + num7;
            ulong num11 = (ulong)((uint)num9);

            num9 >>= 32;
            num9  += (ulong)xx[3] + num8;
            z[3]   = (uint)num9;
            num9 >>= 32;
            num7  -= num;
            num8  -= num2;
            num9  += (ulong)xx[4] + num7;
            z[4]   = (uint)num9;
            num9 >>= 32;
            num9  += (ulong)xx[5] + num8;
            z[5]   = (uint)num9;
            num9 >>= 32;
            num11 += num9;
            num9  += (ulong)num10;
            z[0]   = (uint)num9;
            num9 >>= 32;
            if (num9 != 0uL)
            {
                num9  += (ulong)z[1];
                z[1]   = (uint)num9;
                num11 += num9 >> 32;
            }
            z[2] = (uint)num11;
            num9 = num11 >> 32;
            if ((num9 != 0uL && Nat.IncAt(6, z, 3) != 0u) || (z[5] == 4294967295u && Nat192.Gte(z, SecP192R1Field.P)))
            {
                SecP192R1Field.AddPInvTo(z);
            }
        }
コード例 #4
0
        public static void Reduce32(uint x, uint[] z)
        {
            ulong num = 0uL;

            if (x != 0u)
            {
                num  += (ulong)z[0] + (ulong)x;
                z[0]  = (uint)num;
                num >>= 32;
                if (num != 0uL)
                {
                    num  += (ulong)z[1];
                    z[1]  = (uint)num;
                    num >>= 32;
                }
                num  += (ulong)z[2] + (ulong)x;
                z[2]  = (uint)num;
                num >>= 32;
            }
            if ((num != 0uL && Nat.IncAt(6, z, 3) != 0u) || (z[5] == 4294967295u && Nat192.Gte(z, SecP192R1Field.P)))
            {
                SecP192R1Field.AddPInvTo(z);
            }
        }