0

I'm currently trying to implement the DFT in Finite Fields in Schönhage Strassen matter as theoretical refreshment for the NTT (FFT variant of the NTT).

My problem is that if I have an array of lets say $256$ elements that I want to process, to use $2$ as $256^\text{th}$ root of unity, I'm calculating in order of $8$, which are $256$ bit numbers and a problem for my application.

Since bit-shifting isn't expensive, it'd be nice if my unitroot would be in relation to the element $2$ or $2$ itself of $\mathrm{GF}(2^n \pm 1)$. At the same time there should be an inverse for every element in $\mathrm{GF}(q)$, where $q = 2^n \pm 1$, so then I can perform the inverse transform properly.

So I assume $q$ needs to be prime. (so I read about Fermat Prime numbers and Mersenne ones - and that s the first problem: the last Fermat Prime is $2^{16} + 1$)

But the ultimate goal, is that when I perform the DFT in an array of dimension $m$ that I get an $m^\text{th}$ root of unity so I can perform it properly. For the NTT $m$ is (normally) always power of $2$ (as long according no Chinese Remainder Theorem is used to restructure/reorder/reorganize the data).

However I fail to recall the relationship of $2$ as root of unity and $\mathrm{GF}(q)$. I numerically found out that $2$ seems to be a $2n^\text{th}$ root of unity in $\mathrm{GF}(2^n + 1)$.

So $(2^n)^2 \equiv 1 \pmod{2^n + 1}$ I also found out that $2^n \equiv 1 \pmod{2^n - 1}$. But that's only the $n^\text{th}$ root of unity which means that I can apply the DFT to an array of $n$ fields, requiring me to calculate in $\mathrm{GF}(2^n - 1)$ which is huge.

Finally I heard that $\sqrt{2}$ in $\mathrm{GF}(2^(n+2) + 1)$ is $2^{n+2}$ root of unity. Since it s a solution to $\theta^{2^{n+2}} \equiv 1 \pmod{2^{n+2} + 1}$. That might apply to my needs.

For that however I need an efficient way to calculate the square roots in $\mathrm{GF}(2^m \pm 1)$. I found a bunch articles which describe how you can calculate it what appears to me by circular shifts however those are only specified for $\mathrm{GF}(2^m)$; and I actually couldn't prove it numerically. Here is the link.

It states that $(x^{2^{n−1}})^2 = x^{2 \cdot 2^{n−1}} = x^{2^n} = x$ in $\mathrm{GF}(2^n)$ with $x^{2^{n-1}}$ so I put it into python:

n = 8
x = 2
(x**(2**(n-1))) % (2**n)  # which is 0 and 0 * 0 
                          # is not 2 in GF(2**n)    
                          # and no other GF

This left me with a lot of confusion. Since calculating in finitefield 2^n does not have a multiplicative inverse for every element, it's probably not an application.

Can somebody look over my research? Is there a proper system behind fitting my problem of array dimension $m = 2^n$ into the DFT and later NTT (FFT variant of it) because $\mathrm{GF}(q)$ with $q$ needs to be prime in order to have proper chances for a proper inverse DFT.

Thank you in advance.

  • About the last snippet. You seem to be confused about what $GF(2^8)$ is. Its arithmetic is NOT the same as integer arithmetic modulo $2^8$. Look up Wikipedia. Or, locally, my old Q&A pair. The latter may not be very useful to you right away, as its focus is on the use of discrete logarithms. That came up often enough earlier in the site's history, so I typed up that page. It does give you an idea of what $GF(8)$ and $GF(16)$ look like, and surely it is easier to begin with a small example. – Jyrki Lahtonen Oct 27 '23 at 10:49
  • 1
    Anyway, $GF(q)$ exists if and only if $q$ is the power of a prime number. And its arithmetic is the modular arithmetic of integers if and only $q$ is a prime. That same Wikipedia page explains the arithmetic of $GF(2^8)$ because that comes up with the Rijndael (AES) crypto standard. – Jyrki Lahtonen Oct 27 '23 at 10:53
  • I probably did not meant GF(2^8) as Rijndael but I get what you mean. Should I correct to finite field or how should I correct it ? I assume that GF(2^8) or GF(2^m) do not have full algebraic capabilities. – rnnUSer11 Oct 27 '23 at 13:30
  • They are fields all right, and in that sense have full algebraic capabilities. But in $GF(2^n)$ there are no roots of unity of even order (let alone higher powers of two). – Jyrki Lahtonen Oct 27 '23 at 13:54

0 Answers0