Exemple #1
0
        public SecT163FieldElement(BigInteger x)
        {
            if (x == null || x.SignValue < 0 || x.BitLength > 163)
                throw new ArgumentException("value invalid for SecT163FieldElement", "x");

            this.x = SecT163Field.FromBigInteger(x);
        }
Exemple #2
0
        public override ECFieldElement SquarePow(int pow)
        {
            if (pow < 1)
                return this;

            ulong[] z = Nat192.Create64();
            SecT163Field.SquareN(x, pow, z);
            return new SecT163FieldElement(z);
        }
Exemple #3
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            ulong[] ax = this.x, bx = ((SecT163FieldElement)b).x;
            ulong[] xx = ((SecT163FieldElement)x).x, yx = ((SecT163FieldElement)y).x;

            ulong[] tt = Nat192.CreateExt64();
            SecT163Field.MultiplyAddToExt(ax, bx, tt);
            SecT163Field.MultiplyAddToExt(xx, yx, tt);

            ulong[] z = Nat192.Create64();
            SecT163Field.Reduce(tt, z);
            return new SecT163FieldElement(z);
        }
Exemple #4
0
 public override ECFieldElement Multiply(ECFieldElement b)
 {
     ulong[] z = Nat192.Create64();
     SecT163Field.Multiply(x, ((SecT163FieldElement)b).x, z);
     return new SecT163FieldElement(z);
 }
Exemple #5
0
 public override ECFieldElement AddOne()
 {
     ulong[] z = Nat192.Create64();
     SecT163Field.AddOne(x, z);
     return new SecT163FieldElement(z);
 }
Exemple #6
0
 public override ECFieldElement Invert()
 {
     ulong[] z = Nat192.Create64();
     SecT163Field.Invert(x, z);
     return new SecT163FieldElement(z);
 }
Exemple #7
0
 public override int Trace()
 {
     return (int)SecT163Field.Trace(x);
 }
Exemple #8
0
 public override ECFieldElement Add(ECFieldElement b)
 {
     ulong[] z = Nat192.Create64();
     SecT163Field.Add(x, ((SecT163FieldElement)b).x, z);
     return(new SecT163FieldElement(z));
 }
Exemple #9
0
 public override ECFieldElement HalfTrace()
 {
     ulong[] z = Nat192.Create64();
     SecT163Field.HalfTrace(x, z);
     return(new SecT163FieldElement(z));
 }