How do we compute a square root of an element in a finite field of characteristics of some prime
p?
It holds:
xp=x
xp+1=x2
Let’s say
p=3 mod 4.
Then it’s simple:
x4p+1=x21
How about in an extended field
Fp(i)
where
i2+1=0?
Let’s say we have an element
x0+x1i.
If
x1=0,
then let’s consider two options.
If
x0
is a square, then we compute it as above for
Fp.
If it is not a square, we take
−x0
and compute a square root of this value in
Fp.
Let’s denote it by
y0.
Then
(y0i)2=x0.
Let’s observe for
x1≠0.
We need
y0+iy1
such that:
y02−y12=x0
2y0y1=x1
We can try to have
u+2ux1i.
We see that the second formula is satisfied this way.
Further, it needs to hold:
u2−4u2x12=x0
u4−x0u2−4x12=0
We solve the quadratic equation and get:
u=√2x0±√x02+x12
If
x02+x12
is not a square, we don’t have a solution.
Note that when the element is not a square, we need to take its negation, compute the square
root of this negation and multiply it by
i (as above).
Fourth root
We have
x0+ix1
and we would like to get
y0+iy1
such that
We can use the fact that the norm is multiplicative, so:
(y02+y12)4=x02+x12
Let’s denote
n=y02+y12.
We can compute
n as a fourth root in
Fp.
We then have:
x0=y04−6y02(n−y02)+(n−y02)2
8y04−8ny02+n2−x0=0
Let
u=y02.
The discriminant of the equation above is:
D=64n2−32(n2−x0)=32(n2+x0)
And we have:
u1,2=168n±√D
=2n±√2n2+x0
So:
y02=2n±√2n2+x0
To compute
y0
we need to compute two square roots in
Fp.
We can then compute
y1
out of
x1=4y1y0(y02−(n−y02))
which requires one inversion.
Thus, we can compute the fourth root of an element in
Fp2
using one fourth root in
Fp,
two square roots in
Fp
and one inversion.
This is faster than repeated square roots, which would be four square roots in
Fp
and two inversions.