Example #1
0
            // D.1.4 91

            /**
             * return a sqrt root - the routine verifies that the calculation
             * returns the right value - if none exists it returns null.
             */
            public override ECFieldElement sqrt()
            {
                // p mod 4 == 3
                if (p.testBit(1))
                {
                    // z = g^(u+1) + p, p = 4u + 3
                    ECFieldElement z = new Fp(p, x.modPow(p.shiftRight(2).add(ECConstants.ONE), p));

                    return(z.square().Equals(this) ? z : null);
                }

                throw new Exception("not done yet");
            }