Ask Your Question

Revision history [back]

To complement @rburing's answer, finite field elements and polynomials over the prime field can be converted to each other easily, without the need to go through a vector.

Construct the finite field and the polynomial ring.

sage: e = 48
sage: K.<a> = GF(2^e)
sage: R.<x> = GF(2)[]

Finite field elements can be converted into polynomials.

sage: y = a^48 + a^27 + 1
sage: y
a^27 + a^25 + a^23 + a^17 + a^12 + a^11 + a^10 + a^8 + a^7 + a^3
sage: z = R(y)
sage: z
x^27 + x^25 + x^23 + x^17 + x^12 + x^11 + x^10 + x^8 + x^7 + x^3

Polynomials can be converted into finite field elements.

sage: u = x^23 + x^12 + x^4
sage: u
x^23 + x^12 + x^4
sage: v = K(u)
sage: v
a^23 + a^12 + a^4