Itoh–Tsujii inversion algorithm
While the algorithm is often called the Itoh-Tsujii algorithm, it was first presented by Feng.<ref>Template:Cite journal</ref> Feng's paper was received on March 13, 1987 and published in October 1989. Itoh and Tsujii's paper was received on July 8, 1987 and published in 1988.<ref>Template:Cite journal</ref>
Feng and Itoh-Tsujii algorithm is first used to invert elements in finite field Template:Math using the normal basis representation of elements, however, it is generic and can be used for other bases, such as the polynomial basis. It can also be used in any finite field Template:Math.
The algorithm is as follows:
- Input: A ∈ GF(pm)
- Output: A−1
- r ← (pm − 1)/(p − 1)
- compute Ar−1 in GF(pm)
- compute Ar = Ar−1 · A
- compute (Ar)−1 in GF(p)
- compute A−1 = (Ar)−1 · Ar−1
- return A−1
This algorithm is fast because steps 3 and 5 both involve operations in the subfield GF(p). Similarly, if a small value of p is used, a lookup table can be used for inversion in step 4. The majority of time spent in this algorithm is in step 2, the first exponentiation. This is one reason why this algorithm is well suited for the normal basis, since squaring and exponentiation are relatively easy in that basis.
This algorithm is based on the fact that Template:Math is a cyclic group of order Template:Math. Given a nonzero element Template:Math in finite field Template:Math, we have <math display="block"> A^{-1}=A^{2^m-2}=A^{2^{m-1}} \cdot A^{2^{m-2}} \cdot A^{2^{m-3}} \cdots A^{2^{2}} \cdot A^{2^{1}}=\prod_{i=1}^{m-1}{A^{2^i}}. </math>
The above Template:Math expression itself is close to that of the multiplicative Norm function in finite field, which is defined as <math display="block"> Norm(A)=\prod_{i=0}^{m-1}{A^{2^i}}. </math>
This viewpoint leads us to consider the additive absolute Trace function <ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> , which is defined as <math display="block"> Tr(A)=\sum_{i=0}^{m-1}{A^{2^i}}. </math>
If Template:Math=0, then we have <math display="block"> A=\sum_{i=1}^{m-1}{A^{2^i}} </math> and can express Template:Math as <math display="block"> A^{-1}=A^{-2}\sum_{i=1}^{m-1}{A^{2^i}}=\sum_{i=1}^{m-1}{A^{2^i-2}}=\sum_{j=0}^{m-2}{(A^2)^{2^{j}-1}}. </math>
In some Template:Maths, for example, Template:Math used in Advanced Encryption Standard (AES), this formula needs 1 less multiplication operation than Feng and Itoh-Tsujii algorithm for elements with Trace value 0: because <math display="block"> 0=Tr(A)=A+A^2+A^4+A^8+A^{16}+A^{32}+A^{64}+A^{128}, </math> we have <math display="block"> A=A^2+A^4+A^8+A^{16}+A^{32}+A^{64}+A^{128} </math> and <math display="block"> A^{-1}=1+A^2+A^6+A^{14}+A^{30}+A^{62}+A^{126}=1+ \{(A+A^3+A^7)+[(A+A^{3}+A^{7})^8A^7] \}^2. </math>
This additive formula needs 3 multiplications, 4 additions and 6 squarings.
But the multiplicative formula <math display="block"> A^{-1}=A^{254}=A^2A^4A^8A^{16}A^{32}A^{64}A^{128}=\{ A(A \cdot A^2A^4)^2 (A \cdot A^2A^4)^{16} \}^2 </math> needs 4 multiplications and 7 squarings.