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:
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 integer s such that:
In this case, a square root of a is given by:
because:
To find such b and s, we set:
s=2p−1
b=(1+a(p−1)/2)(p−1)/2
Case 1: b=0
We can verify:
So, x=b⋅a(p+1)/4 is a valid square root of a.
Explanations
This step works due to the properties of the Frobenius endomorphism, which states 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:
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:
In this case, define x=a(p+1)/4⋅i, where i2=−1. Then:
Thus, x is again a valid square root of a.
Final Formula
We can summarize the square root of a∈Fp2, for p≡3(mod4), as:
This elegant formula generalizes the classic Shanks algorithm from Fp to quadratic extensions Fp2, and avoids iterative procedures entirely.
Written by Ryan Kim of Fractalyze
Last updated