Generalized Shanks Algorithm for Quadratic Extension Field
This section explains how to compute square roots in the quadratic extension field Fp2, particularly when the base field Fp satisfies p≡3(mod4). The method is based on Algorithm 9 from ePrint 2012/685.
Goal
Given a∈Fp2, find x∈Fp2 such that:
x2=a
where x=x0+x1⋅i and i2=−1.
Algorithm
The algorithm proceeds as follows:
Compute a1=a(p−3)/4
Compute α=a12⋅a=a(p−1)/2
Check whether αp+1=a(p2−1)/2=−1. If so, then a is a non-residue, and no square root exists.
Compute β=a1⋅a=a(p+1)/4
If α=−1, return x=β⋅i=a(p+1)/4⋅i
Otherwise:
Compute b=(α+1)(p−1)/2=(1+a(p−1)/2)(p−1)/2
Return x=b⋅β=(1+a(p−1)/2)(p−1)/2⋅a(p+1)/4
Intuition Behind the Algorithm
To compute a square root of a∈Fp2, we can find an element b∈Fp2 and an odd integers such that:
since exponentiation by p acts as an automorphism over Fp2, and in particular, fixes elements in the base field Fp.
In addition, every nonzero element a∈Fp2 satisfies:
ap2−1=1
because the multiplicative group Fp2∗ has order p2−1. This ensures that all powers used in the algorithm, including a(p2−1)/2, are well-defined and lie within the group.
Case 2: b=0
Then, by definition of b, we must have:
1+a(p−1)/2=0⇒a(p−1)/2=−1
In this case, define x=a(p+1)/4⋅i, where i2=−1. Then: