Multiplication inverse element in a finite field

Source: Internet
Author: User

It is widely used in cryptography and security fields. Including the well-known Euclidean Algorithm for the most common factor.

This article describes how to calculate the inverse element of multiplication in a finite field. Including integers and polynomials. The extended Euclid algorithm is used. There is a great Gartner proposal.

1. Multiplication against RMB W': Any w belongs to ZP, W! = 0. The existence of Z is ZP so that w * z = 1 (mod P );

Example 5: Calculate the multiplication inverse element of MOD 14. 5*3 = 1 (mod 14); so the modulo 14 multiplication inverse element of 5 is 3;

2. Multiplication of integers inverse element

Extended Euclid algorithm flow:

1. (A1, A2, A3) = (1, 0, m); (B1, B2, B3) = (0, 1, B)

2. If B3 = 0 return no inverse;

3. If B3 = 1 return B2;

4. q = a2/B3;

5. (T1, T2, T3) = (A1-Q * B1, A2-Q * B2, A3-Q * B3 );

6. (A1, A2, A3) = (B1, B2, B3)

7. (B1, B2, B3) = (T1, T2, T3)

8. goto2

Code:

Int gcd (int A, int B) {if (a <B) {A ^ = B; B ^ = A; A ^ = B;} while (B! = 0) {int temp = A; A = B; B = TEMP % B;} return a;} // extend Euclidean to evaluate B in GF (m) only the mutual quality of B and M has the inverse element. Int Euclid (int m, int B) {int A [4]; A [1] = 1; A [2] = 0; A [3] = m; int B [4]; B [1] = 0; B [2] = 1; B [3] = B; while (true) {If (0 = B [3]) {cout <"no reverse element" <Endl; return gcd (M, B );} else if (1 = B [3]) {cout <"reverse meta:" <B [2] <Endl; return B [2];} int quotient = A [3]/B [3]; int T [4]; t [1] = A [1]-Quotient * B [1]; T [2] = A [2]-Quotient * B [2]; t [3] = A [3]-Quotient * B [3]; A [1] = B [1]; A [2] = B [2]; A [3] = B [3]; B [1] = T [1]; B [2] = T [2]; B [3] = T [3];} return 0;} int main () {Euclid (14, 5 ); euclid (8, 4 );}

3. polynomial multiplication inverse element

The inverse principle of Polynomial multiplication is the same as that of integer multiplication. It is only a polynomial.

Method 1: polynomial addition, subtraction, multiplication, division

Method 2: Use an integer (Binary bit) to simulate the addition, subtraction, multiplication, and division of polynomials. This method is also the simplest and most appropriate method.

For example, x ^ 8 + x ^ 4 + x ^ 3 + x + 1 is described in binary format. 100011011 can be stored as an integer of 283.

Let's take a closer look. For the multiplication of two polynomials, the polynomial addition is not directly to this integer or multiplication or addition. Division is a little more complex. The first time we found that we could use Integers to simulate polynomial calculation. Very knowledgeable! .

Reference: http://blog.csdn.net/wjh200821/article/details/7570573

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.