public override ECFieldElement SquarePow(int pow)
        {
            if (pow < 1)
            {
                return(this);
            }

            ulong[] z = Nat320.Create64();
            SecT283Field.SquareN(x, pow, z);
            return(new SecT283FieldElement(z));
        }
示例#2
0
 public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y)
 {
     ulong[] array  = this.x;
     ulong[] array2 = ((SecT283FieldElement)x).x;
     ulong[] y2     = ((SecT283FieldElement)y).x;
     ulong[] array3 = Nat.Create64(9);
     SecT283Field.SquareAddToExt(array, array3);
     SecT283Field.MultiplyAddToExt(array2, y2, array3);
     ulong[] z = Nat320.Create64();
     SecT283Field.Reduce(array3, z);
     return(new SecT283FieldElement(z));
 }
示例#3
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            ulong[] ax = this.x, bx = ((SecT283FieldElement)b).x;
            ulong[] xx = ((SecT283FieldElement)x).x, yx = ((SecT283FieldElement)y).x;

            ulong[] tt = Nat.Create64(9);
            SecT283Field.MultiplyAddToExt(ax, bx, tt);
            SecT283Field.MultiplyAddToExt(xx, yx, tt);

            ulong[] z = Nat320.Create64();
            SecT283Field.Reduce(tt, z);
            return(new SecT283FieldElement(z));
        }
 public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
 {
     ulong[] numArray  = this.x;
     ulong[] numArray2 = ((SecT283FieldElement)b).x;
     ulong[] numArray3 = ((SecT283FieldElement)x).x;
     ulong[] numArray4 = ((SecT283FieldElement)y).x;
     ulong[] zz        = Nat.Create64(9);
     SecT283Field.MultiplyAddToExt(numArray, numArray2, zz);
     SecT283Field.MultiplyAddToExt(numArray3, numArray4, zz);
     ulong[] z = Nat320.Create64();
     SecT283Field.Reduce(zz, z);
     return(new SecT283FieldElement(z));
 }
示例#5
0
 public static void MultiplyAddToExt(ulong[] x, ulong[] y, ulong[] zz)
 {
     ulong[] array = Nat320.CreateExt64();
     SecT283Field.ImplMultiply(x, y, array);
     SecT283Field.AddExt(zz, array, zz);
 }
示例#6
0
 public static void Multiply(ulong[] x, ulong[] y, ulong[] z)
 {
     ulong[] array = Nat320.CreateExt64();
     SecT283Field.ImplMultiply(x, y, array);
     SecT283Field.Reduce(array, z);
 }
示例#7
0
 public static ulong[] FromBigInteger(BigInteger x)
 {
     ulong[] array = Nat320.FromBigInteger64(x);
     SecT283Field.Reduce37(array, 0);
     return(array);
 }
示例#8
0
        protected static void ImplMultiply(ulong[] x, ulong[] y, ulong[] zz)
        {
            ulong[] array  = new ulong[5];
            ulong[] array2 = new ulong[5];
            SecT283Field.ImplExpand(x, array);
            SecT283Field.ImplExpand(y, array2);
            ulong[] array3 = new ulong[26];
            SecT283Field.ImplMulw(array[0], array2[0], array3, 0);
            SecT283Field.ImplMulw(array[1], array2[1], array3, 2);
            SecT283Field.ImplMulw(array[2], array2[2], array3, 4);
            SecT283Field.ImplMulw(array[3], array2[3], array3, 6);
            SecT283Field.ImplMulw(array[4], array2[4], array3, 8);
            ulong num  = array[0] ^ array[1];
            ulong num2 = array2[0] ^ array2[1];
            ulong num3 = array[0] ^ array[2];
            ulong num4 = array2[0] ^ array2[2];
            ulong num5 = array[2] ^ array[4];
            ulong num6 = array2[2] ^ array2[4];
            ulong num7 = array[3] ^ array[4];
            ulong num8 = array2[3] ^ array2[4];

            SecT283Field.ImplMulw(num3 ^ array[3], num4 ^ array2[3], array3, 18);
            SecT283Field.ImplMulw(num5 ^ array[1], num6 ^ array2[1], array3, 20);
            ulong num9  = num ^ num7;
            ulong num10 = num2 ^ num8;
            ulong x2    = num9 ^ array[2];
            ulong y2    = num10 ^ array2[2];

            SecT283Field.ImplMulw(num9, num10, array3, 22);
            SecT283Field.ImplMulw(x2, y2, array3, 24);
            SecT283Field.ImplMulw(num, num2, array3, 10);
            SecT283Field.ImplMulw(num3, num4, array3, 12);
            SecT283Field.ImplMulw(num5, num6, array3, 14);
            SecT283Field.ImplMulw(num7, num8, array3, 16);
            zz[0] = array3[0];
            zz[9] = array3[9];
            ulong num11 = array3[0] ^ array3[1];
            ulong num12 = num11 ^ array3[2];
            ulong num13 = num12 ^ array3[10];

            zz[1] = num13;
            ulong num14 = array3[3] ^ array3[4];
            ulong num15 = array3[11] ^ array3[12];
            ulong num16 = num14 ^ num15;
            ulong num17 = num12 ^ num16;

            zz[2] = num17;
            ulong num18 = num11 ^ num14;
            ulong num19 = array3[5] ^ array3[6];
            ulong num20 = num18 ^ num19;
            ulong num21 = num20 ^ array3[8];
            ulong num22 = array3[13] ^ array3[14];
            ulong num23 = num21 ^ num22;
            ulong num24 = array3[18] ^ array3[22];
            ulong num25 = num24 ^ array3[24];
            ulong num26 = num23 ^ num25;

            zz[3] = num26;
            ulong num27 = array3[7] ^ array3[8];
            ulong num28 = num27 ^ array3[9];
            ulong num29 = num28 ^ array3[17];

            zz[8] = num29;
            ulong num30 = num28 ^ num19;
            ulong num31 = array3[15] ^ array3[16];
            ulong num32 = num30 ^ num31;

            zz[7] = num32;
            ulong num33 = num32 ^ num13;
            ulong num34 = array3[19] ^ array3[20];
            ulong num35 = array3[25] ^ array3[24];
            ulong num36 = array3[18] ^ array3[23];
            ulong num37 = num34 ^ num35;
            ulong num38 = num37 ^ num36;
            ulong num39 = num38 ^ num33;

            zz[4] = num39;
            ulong num40 = num17 ^ num29;
            ulong num41 = num37 ^ num40;
            ulong num42 = array3[21] ^ array3[22];
            ulong num43 = num41 ^ num42;

            zz[5] = num43;
            ulong num44 = num21 ^ array3[0];
            ulong num45 = num44 ^ array3[9];
            ulong num46 = num45 ^ num22;
            ulong num47 = num46 ^ array3[21];
            ulong num48 = num47 ^ array3[23];
            ulong num49 = num48 ^ array3[25];

            zz[6] = num49;
            SecT283Field.ImplCompactExt(zz);
        }
示例#9
0
 public static void SquareAddToExt(ulong[] x, ulong[] zz)
 {
     ulong[] array = Nat.Create64(9);
     SecT283Field.ImplSquare(x, array);
     SecT283Field.AddExt(zz, array, zz);
 }
示例#10
0
 public static void Square(ulong[] x, ulong[] z)
 {
     ulong[] array = Nat.Create64(9);
     SecT283Field.ImplSquare(x, array);
     SecT283Field.Reduce(array, z);
 }
示例#11
0
 public override ECFieldElement Multiply(ECFieldElement b)
 {
     ulong[] z = Nat320.Create64();
     SecT283Field.Multiply(x, ((SecT283FieldElement)b).x, z);
     return(new SecT283FieldElement(z));
 }
示例#12
0
 public override ECFieldElement AddOne()
 {
     ulong[] z = Nat320.Create64();
     SecT283Field.AddOne(x, z);
     return(new SecT283FieldElement(z));
 }
示例#13
0
 public override int Trace()
 {
     return((int)SecT283Field.Trace(x));
 }
示例#14
0
 public override ECFieldElement Square()
 {
     ulong[] z = Nat320.Create64();
     SecT283Field.Square(this.x, z);
     return(new SecT283FieldElement(z));
 }
示例#15
0
 public override ECFieldElement Add(ECFieldElement b)
 {
     ulong[] z = Nat320.Create64();
     SecT283Field.Add(this.x, ((SecT283FieldElement)b).x, z);
     return(new SecT283FieldElement(z));
 }