Professional Documents
Culture Documents
Whether X: Computing Square Roots Mod P
Whether X: Computing Square Roots Mod P
Whether X: Computing Square Roots Mod P
p
€
€ €
Consider the latter case, p = 8k + 5, first. By Euler’s
p−1
x ≡€a 2k+ 2 ≡ a
€ 2 4
≡a 4
⋅ a ≡ a (mod p).
€
p−1
p−1 p+3
€ 2 4 k+ 2 2k+2
x ≡2 a ≡2 a 2 4
€ 2 p−1
≡ ⋅a 4 ⋅a ≡ −1 ⋅−1 ⋅a ≡ a(mod p).
p
p−1 a
2r−1 s 2r−1
b = (a ) =a 2
≡ ≡ 1 (mod p) ⇒ ord pb|2r−1
p
so that
€
ord pz = 2 ⋅ ord pb|2r ⇒ ord pz is a power of 2 ≤ 2r
p−1
2r−1 s 2r−1
Proof By EC, m = (n ) =n 2
≡ −1 (mod p).
€ But by Fermat’s €
Little Theorem,
2r s 2r
m = (n ) = n p−1 ≡ 1 (mod p), so we must have that
ord p m€= 2r . Thus the first 2r powers of m are
distinct mod p and all lie in S. But as there are
€ ϕ (2 k ) elements of order 2 k, and each of these orders
€ €
€ €
is a factor of 2r , the total number of elements whose
order divides 2r is
r
€ ∑ ϕ (2 k ) = ∑ ϕ (d) = 2r ,
€ k=0 d|2r
€ € r 2r−1
Proof Since ord p m = 2 , we have m ≡/ 1 (mod p)
€ but (m 2r−1 )2 ≡ m2r ≡ 1 (mod p), whence
2r−1 2u−1
m ≡ −1 (mod p). Similarly, b ≡ −1 (mod p).
€ €
Therefore,
€
2r−u 2u−1 2r−1 2u−1
€ (m b) ≡m b
€ ≡ (−1)(−1) ≡ 1 (mod p),
2r−u
which implies that the order of m b mod p must
€ divide 2u−1. //
Example: x 2 ≡ 2 (mod41)
€ €
€
We can make this computation more amenable to
automation by organizing the steps as follows
(here, ≡ means congruence mod p):
€ € €
Thus x ≡ 32 (mod113).
€
€ €
€
Example: x 2 ≡ 103 (mod641)