Function ff::helpers::sqrt_tonelli_shanks
source · pub fn sqrt_tonelli_shanks<F: PrimeField, S: AsRef<[u64]>>(
f: &F,
tm1d2: S,
) -> CtOption<F>
Expand description
Constant-time implementation of Tonelli–Shanks’ square-root algorithm for
p mod 16 = 1
.
tm1d2
should be set to (t - 1) // 2
, where t = (modulus - 1) >> F::S
.
§Implementing Field::sqrt
This function can be used to implement Field::sqrt
for fields that both implement
PrimeField
and satisfy p mod 16 = 1
.