Hi Santanu!
On 25 Aug., 18:03, Santanu Sarkar <
sarkar.santanu....@gmail.com>
wrote:
> How to calculate inverse of a polynomial f(x) modulo g(x) in the finite
> field GF(2^10)?
The usual way to compute modular inverses in a polynomial ring over a
field is the extended Euclidean algorithm, xgcd.
We start with a polynomial ring over GF(2^10):
sage: P.<x> = GF(2^10,'z')[]
Next, we get two random polynomials. They happen to be relatively
prime, hence, there *is* an inverse of the first polynomial modulo the
second polynomial:
sage: p = P.random_element()
sage: q = P.random_element()
sage: gcd(p,q)
1
Now, xgcd is a method of q, and I suggest that you read its
documentation.
sage: d, _, pinv = q.xgcd(p)
sage: d # test again that the gcd is one
1
Now, we verify that pinv really is the inverse of p modulo q:
sage: q.divides(1-p*pinv)
True
Best regards,
Simon