コード例 #1
0
 public SecT131FieldElement(BigInteger x)
 {
     if (x == null || x.SignValue < 0)
     {
         throw new ArgumentException("value invalid for SecT131FieldElement", "x");
     }
     this.x = SecT131Field.FromBigInteger(x);
 }
コード例 #2
0
 public SecT131FieldElement(BigInteger x)
 {
     if (((x == null) || (x.SignValue < 0)) || (x.BitLength > 0x83))
     {
         throw new ArgumentException("value invalid for SecT131FieldElement", "x");
     }
     this.x = SecT131Field.FromBigInteger(x);
 }
コード例 #3
0
 public SecT131FieldElement(BigInteger x)
 {
     //IL_0029: Unknown result type (might be due to invalid IL or missing references)
     if (x == null || x.SignValue < 0 || x.BitLength > 131)
     {
         throw new ArgumentException("value invalid for SecT131FieldElement", "x");
     }
     this.x = SecT131Field.FromBigInteger(x);
 }
コード例 #4
0
 public override ECFieldElement SquarePow(int pow)
 {
     if (pow < 1)
     {
         return(this);
     }
     ulong[] z = Nat192.Create64();
     SecT131Field.SquareN(x, pow, z);
     return(new SecT131FieldElement(z));
 }
コード例 #5
0
 public static void SquareN(ulong[] x, int n, ulong[] z)
 {
     ulong[] array = Nat.Create64(5);
     SecT131Field.ImplSquare(x, array);
     SecT131Field.Reduce(array, z);
     while (--n > 0)
     {
         SecT131Field.ImplSquare(z, array);
         SecT131Field.Reduce(array, z);
     }
 }
コード例 #6
0
 public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y)
 {
     ulong[] array  = this.x;
     ulong[] array2 = ((SecT131FieldElement)x).x;
     ulong[] y2     = ((SecT131FieldElement)y).x;
     ulong[] array3 = Nat.Create64(5);
     SecT131Field.SquareAddToExt(array, array3);
     SecT131Field.MultiplyAddToExt(array2, y2, array3);
     ulong[] z = Nat192.Create64();
     SecT131Field.Reduce(array3, z);
     return(new SecT131FieldElement(z));
 }
コード例 #7
0
 public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
 {
     ulong[] numArray  = this.x;
     ulong[] numArray2 = ((SecT131FieldElement)b).x;
     ulong[] numArray3 = ((SecT131FieldElement)x).x;
     ulong[] numArray4 = ((SecT131FieldElement)y).x;
     ulong[] zz        = Nat.Create64(5);
     SecT131Field.MultiplyAddToExt(numArray, numArray2, zz);
     SecT131Field.MultiplyAddToExt(numArray3, numArray4, zz);
     ulong[] z = Nat192.Create64();
     SecT131Field.Reduce(zz, z);
     return(new SecT131FieldElement(z));
 }
コード例 #8
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            ulong[] ax = this.x, bx = ((SecT131FieldElement)b).x;
            ulong[] xx = ((SecT131FieldElement)x).x, yx = ((SecT131FieldElement)y).x;

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

            ulong[] z = Nat192.Create64();
            SecT131Field.Reduce(tt, z);
            return(new SecT131FieldElement(z));
        }
コード例 #9
0
 public override ECFieldElement Multiply(ECFieldElement b)
 {
     ulong[] z = Nat192.Create64();
     SecT131Field.Multiply(x, ((SecT131FieldElement)b).x, z);
     return(new SecT131FieldElement(z));
 }
コード例 #10
0
 public static void MultiplyAddToExt(ulong[] x, ulong[] y, ulong[] zz)
 {
     ulong[] array = Nat192.CreateExt64();
     SecT131Field.ImplMultiply(x, y, array);
     SecT131Field.AddExt(zz, array, zz);
 }
コード例 #11
0
 public override int Trace()
 {
     return((int)SecT131Field.Trace(x));
 }
コード例 #12
0
 public override ECFieldElement AddOne()
 {
     ulong[] z = Nat192.Create64();
     SecT131Field.AddOne(x, z);
     return(new SecT131FieldElement(z));
 }
コード例 #13
0
        protected static void ImplMultiply(ulong[] x, ulong[] y, ulong[] zz)
        {
            ulong num  = x[0];
            ulong num2 = x[1];
            ulong num3 = x[2];

            num3 = ((num2 >> 24 ^ num3 << 40) & 17592186044415uL);
            num2 = ((num >> 44 ^ num2 << 20) & 17592186044415uL);
            num &= 17592186044415uL;
            ulong num4 = y[0];
            ulong num5 = y[1];
            ulong num6 = y[2];

            num6  = ((num5 >> 24 ^ num6 << 40) & 17592186044415uL);
            num5  = ((num4 >> 44 ^ num5 << 20) & 17592186044415uL);
            num4 &= 17592186044415uL;
            ulong[] array = new ulong[10];
            SecT131Field.ImplMulw(num, num4, array, 0);
            SecT131Field.ImplMulw(num3, num6, array, 2);
            ulong num7 = num ^ num2 ^ num3;
            ulong num8 = num4 ^ num5 ^ num6;

            SecT131Field.ImplMulw(num7, num8, array, 4);
            ulong num9  = num2 << 1 ^ num3 << 2;
            ulong num10 = num5 << 1 ^ num6 << 2;

            SecT131Field.ImplMulw(num ^ num9, num4 ^ num10, array, 6);
            SecT131Field.ImplMulw(num7 ^ num9, num8 ^ num10, array, 8);
            ulong num11 = array[6] ^ array[8];
            ulong num12 = array[7] ^ array[9];
            ulong num13 = num11 << 1 ^ array[6];
            ulong num14 = num11 ^ num12 << 1 ^ array[7];
            ulong num15 = num12;
            ulong num16 = array[0];
            ulong num17 = array[1] ^ array[0] ^ array[4];
            ulong num18 = array[1] ^ array[5];
            ulong num19 = num16 ^ num13 ^ array[2] << 4 ^ array[2] << 1;
            ulong num20 = num17 ^ num14 ^ array[3] << 4 ^ array[3] << 1;
            ulong num21 = num18 ^ num15;

            num20  ^= num19 >> 44;
            num19  &= 17592186044415uL;
            num21  ^= num20 >> 44;
            num20  &= 17592186044415uL;
            num19   = (num19 >> 1 ^ (num20 & 1uL) << 43);
            num20   = (num20 >> 1 ^ (num21 & 1uL) << 43);
            num21 >>= 1;
            num19  ^= num19 << 1;
            num19  ^= num19 << 2;
            num19  ^= num19 << 4;
            num19  ^= num19 << 8;
            num19  ^= num19 << 16;
            num19  ^= num19 << 32;
            num19  &= 17592186044415uL;
            num20  ^= num19 >> 43;
            num20  ^= num20 << 1;
            num20  ^= num20 << 2;
            num20  ^= num20 << 4;
            num20  ^= num20 << 8;
            num20  ^= num20 << 16;
            num20  ^= num20 << 32;
            num20  &= 17592186044415uL;
            num21  ^= num20 >> 43;
            num21  ^= num21 << 1;
            num21  ^= num21 << 2;
            num21  ^= num21 << 4;
            num21  ^= num21 << 8;
            num21  ^= num21 << 16;
            num21  ^= num21 << 32;
            zz[0]   = num16;
            zz[1]   = (num17 ^ num19 ^ array[2]);
            zz[2]   = (num18 ^ num20 ^ num19 ^ array[3]);
            zz[3]   = (num21 ^ num20);
            zz[4]   = (num21 ^ array[2]);
            zz[5]   = array[3];
            SecT131Field.ImplCompactExt(zz);
        }
コード例 #14
0
 public override ECFieldElement Invert()
 {
     ulong[] z = Nat192.Create64();
     SecT131Field.Invert(this.x, z);
     return(new SecT131FieldElement(z));
 }
コード例 #15
0
 public static ulong[] FromBigInteger(BigInteger x)
 {
     ulong[] array = Nat192.FromBigInteger64(x);
     SecT131Field.Reduce61(array, 0);
     return(array);
 }
コード例 #16
0
 public static void SquareAddToExt(ulong[] x, ulong[] zz)
 {
     ulong[] array = Nat.Create64(5);
     SecT131Field.ImplSquare(x, array);
     SecT131Field.AddExt(zz, array, zz);
 }
コード例 #17
0
 public static void Square(ulong[] x, ulong[] z)
 {
     ulong[] array = Nat.Create64(5);
     SecT131Field.ImplSquare(x, array);
     SecT131Field.Reduce(array, z);
 }
コード例 #18
0
 public override ECFieldElement Add(ECFieldElement b)
 {
     ulong[] z = Nat192.Create64();
     SecT131Field.Add(this.x, ((SecT131FieldElement)b).x, z);
     return(new SecT131FieldElement(z));
 }
コード例 #19
0
 public static void Multiply(ulong[] x, ulong[] y, ulong[] z)
 {
     ulong[] array = Nat192.CreateExt64();
     SecT131Field.ImplMultiply(x, y, array);
     SecT131Field.Reduce(array, z);
 }