Computes a modular square root directly when the prime modulus is congruent to 3 modulo 4. For input a, raise a to (p+1)/4 modulo p; the result is the candidate root. section 2.5
The implementation follows a short decision path:
- Fall back to Tonelli–Shanks when bit 1 is clear. section 2.5
Choosing the method
For 27213068317, inspect the modulus’ low bits: because the number is congruent to 1 modulo 4, use Tonelli–Shanks rather than the power method. section 2.5
