How to Use
Enter a and prime p:
- Roots: Both x and p−x
- QR?: Quadratic residue check
- Steps: Algorithm trace
Tonelli-Shanks
Write p−1 = Q·2^S. Find non-residue z. Set M=S, c=z^Q, t=a^Q, R=a^((Q+1)/2). Loop: if t≡1, return R. Find least i with t^(2^i)≡1. Update c,t,R,M. Runs in O(log²p) time.
Cryptography
Used in: elliptic curve point decompression (recover y from x), RSA-OAEP, and Rabin cryptosystem (decryption requires modular square roots). The Rabin system's security is provably equivalent to factoring.
Step-by-Step Instructions
- 1Enter value a.
- 2Enter prime p.
- 3Check QR.
- 4Compute roots.
- 5View algorithm.