示例#1
0
 public override ECFieldElement Sqrt()
 {
     uint[] array = x;
     if (Nat.IsZero(17, array) || Nat.IsOne(17, array))
     {
         return(this);
     }
     uint[] z      = Nat.Create(17);
     uint[] array2 = Nat.Create(17);
     SecP521R1Field.SquareN(array, 519, z);
     SecP521R1Field.Square(z, array2);
     return((!Nat.Eq(17, array, array2)) ? null : new SecP521R1FieldElement(z));
 }
示例#2
0
 public override ECFieldElement Sqrt()
 {
     uint[] x = this.x;
     if (Nat.IsZero(0x11, x) || Nat.IsOne(0x11, x))
     {
         return(this);
     }
     uint[] z         = Nat.Create(0x11);
     uint[] numArray3 = Nat.Create(0x11);
     SecP521R1Field.SquareN(x, 0x207, z);
     SecP521R1Field.Square(z, numArray3);
     return(!Nat.Eq(0x11, x, numArray3) ? null : new SecP521R1FieldElement(z));
 }
示例#3
0
        /**
         * return a sqrt root - the routine verifies that the calculation returns the right value - if
         * none exists it returns null.
         */
        public override ECFieldElement Sqrt()
        {
            // Raise this element to the exponent 2^519

            uint[] x1 = this.x;
            if (Nat.IsZero(17, x1) || Nat.IsOne(17, x1))
            {
                return(this);
            }

            uint[] t1 = Nat.Create(17);
            uint[] t2 = Nat.Create(17);

            SecP521R1Field.SquareN(x1, 519, t1);
            SecP521R1Field.Square(t1, t2);

            return(Nat.Eq(17, x1, t2) ? new SecP521R1FieldElement(t1) : null);
        }