Search code examples
pythonsagefinite-field

Binary field inversion using SAGE


I am quite frustrated about the SAGE documentations on Finite field operations. What I want to do is the following:

In GF(2^8) with irreducible polynomial x^8+x^4+x^3+x+1, I would like to find the inverse of element x^8+1. How can I do that in SAGE?


Solution

  • You do

    sage: _.<X> = GF(2)[]
    sage: K.<x> = GF(2^8, modulus=X^8+X^4+X^3+X+1)
    sage: (x^8 + 1)^-1
    x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + 1