The Tonelli-Shanks algorithm finds a square root of a quadratic residue modulo an odd prime number . Handle separately and use the Legendre symbol to reject a quadratic nonresidue. Write with odd, choose a quadratic nonresidue , and initializemodulo . Maintain , with of multiplicative order and of multiplicative order dividing .
If , find the least with . Set and updateThe multiplicative order of decreases because its last nontrivial power and that of are both minus one. Thus strictly decreases. At , the invariant gives .
Articles by others on the same topic
The Tonelli–Shanks algorithm is a method used to compute square roots in finite fields, particularly useful for finding square roots of a number modulo a prime. This algorithm is significant in number theory and has applications in cryptography, especially in schemes dealing with quadratic residues.