Пример #1
0
        public SecT233FieldElement(BigInteger x)
        {
            if (x == null || x.SignValue < 0 || x.BitLength > 233)
            {
                throw new ArgumentException("value invalid for SecT233FieldElement", "x");
            }

            this.x = SecT233Field.FromBigInteger(x);
        }
Пример #2
0
        public override ECFieldElement SquarePow(int pow)
        {
            if (pow < 1)
            {
                return(this);
            }

            ulong[] z = Nat256.Create64();
            SecT233Field.SquareN(x, pow, z);
            return(new SecT233FieldElement(z));
        }
Пример #3
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            ulong[] ax = this.x, bx = ((SecT233FieldElement)b).x;
            ulong[] xx = ((SecT233FieldElement)x).x, yx = ((SecT233FieldElement)y).x;

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

            ulong[] z = Nat256.Create64();
            SecT233Field.Reduce(tt, z);
            return(new SecT233FieldElement(z));
        }
Пример #4
0
 public override ECFieldElement Multiply(ECFieldElement b)
 {
     ulong[] z = Nat256.Create64();
     SecT233Field.Multiply(x, ((SecT233FieldElement)b).x, z);
     return(new SecT233FieldElement(z));
 }
Пример #5
0
 public override ECFieldElement AddOne()
 {
     ulong[] z = Nat256.Create64();
     SecT233Field.AddOne(x, z);
     return(new SecT233FieldElement(z));
 }
Пример #6
0
 public override int Trace()
 {
     return((int)SecT233Field.Trace(x));
 }