/// Return the square root of self mod p, or zero if no square root exists.
Return the square root of self mod p, or zero if no square root exists.
Return the square root of self mod p or zero if no square root exists .
pub fn sqrt(&self) -> Self {
        // For p == 3 (mod 4) square root can be computed using x^(p+1)/4
        // See I.1 of draft-irtf-cfrg-hash-to-curve-12
        // This function could be much faster using an improved addition chain:
        // https://github.com/bitcoin-core/secp256k1/commit/f8ccd9befdb22824ef9a845a90e3db57c1307c11
        let sqrt = self.pow_vartime(&MODULUS_PLUS_1_OVER_4);
        // Check that the result is valid before returning
        if sqrt.square().ct_eq(self) {
            return sqrt;
        }
        Self::zero()
    }
pub fn sqrt ( & self ) -> Self { // For p == 3 (mod 4) square root can be computed using x^(p+1)/4 // See I.1 of draft-irtf-cfrg-hash-to-curve-12 // This function could be much faster using an improved addition chain: // https://github.com/bitcoin-core/secp256k1/commit/f8ccd9befdb22824ef9a845a90e3db57c1307c11 let sqrt = self . pow_vartime ( & MODULUS_PLUS_1_OVER_4 ) ; // Check that the result is valid before returning if sqrt . square ( ) . ct_eq ( self ) { return sqrt ; } Self :: zero ( ) }
Return the square root of self mod p, or zero if no square root exists.
Return the square root of self mod p or zero if no square root exists .
&self