//! Square root and Legendre symbol over the Goldilocks field.
//!
//! Uses Tonelli-Shanks with z = 7 (quadratic non-residue).
//! p - 1 = 2^32 ร s where s = ฮต = 2^32 - 1.
use crate;
const HALF_P: u64 = / 2; // 0x7FFFFFFF80000000
/// Legendre symbol: returns 0, 1, or p-1.
/// Compute the square root of `n` in the Goldilocks field.
///
/// Returns `Some(r)` where r <= (p-1)/2 (canonical sign),
/// or `None` if `n` is a quadratic non-residue.
nebu/rs/sqrt.rs
ฯ 0.0%