Hi Dave,
Most of the trickery is not too bad, let's have
In[73]:= Remove[cfs]
cfs = RandomInteger[{0, 2^8 - 1}, 50]
Out[74]= {118, 123, 55, 190, 90, 83, 146, 249, 202, 186, 130, 180, \
156, 74, 142, 190, 33, 180, 161, 136, 21, 20, 97, 182, 7, 187, 206, \
37, 96, 124, 48, 15, 170, 158, 89, 182, 153, 66, 86, 251, 83, 251, \
15, 83, 61, 39, 152, 162, 138, 188}
and then get
In[75]:= Plus @@ (Table[
x^n ElementToPolynomial[
FromElementCode[GF[2, 8], cfs[[n + 1]]], y], {n, 0,
Length[cfs] - 1}] /. ElementToPolynomial[0, y] -> 0) /.
Times[Power[x, n_: 1],
z_] :> (x^n PolynomialToElement[GF[2, 8], z] /;
FreeQ[z, x]) // Timing
Out[75]= {0.015600, (y + y^2 + y^4 + y^5 + y^6 +
x^28 Subscript[{0, 0, 0, 0, 0, 1, 1, 0}, 2] +
x^30 Subscript[{0, 0, 0, 0, 1, 1, 0, 0}, 2] +
x^19 Subscript[{0, 0, 0, 1, 0, 0, 0, 1}, 2] +
x^46 Subscript[{0, 0, 0, 1, 1, 0, 0, 1}, 2] +
x^21 Subscript[{0, 0, 1, 0, 1, 0, 0, 0}, 2] +
x^11 Subscript[{0, 0, 1, 0, 1, 1, 0, 1}, 2] +
x^17 Subscript[{0, 0, 1, 0, 1, 1, 0, 1}, 2] +
x^12 Subscript[{0, 0, 1, 1, 1, 0, 0, 1}, 2] +
x^49 Subscript[{0, 0, 1, 1, 1, 1, 0, 1}, 2] +
x^29 Subscript[{0, 0, 1, 1, 1, 1, 1, 0}, 2] +
x^10 Subscript[{0, 1, 0, 0, 0, 0, 0, 1}, 2] +
x^37 Subscript[{0, 1, 0, 0, 0, 0, 1, 0}, 2] +
x^47 Subscript[{0, 1, 0, 0, 0, 1, 0, 1}, 2] +
x^6 Subscript[{0, 1, 0, 0, 1, 0, 0, 1}, 2] +
x^48 Subscript[{0, 1, 0, 1, 0, 0, 0, 1}, 2] +
x^13 Subscript[{0, 1, 0, 1, 0, 0, 1, 0}, 2] +
x^8 Subscript[{0, 1, 0, 1, 0, 0, 1, 1}, 2] +
x^32 Subscript[{0, 1, 0, 1, 0, 1, 0, 1}, 2] +
x^4 Subscript[{0, 1, 0, 1, 1, 0, 1, 0}, 2] +
x^9 Subscript[{0, 1, 0, 1, 1, 1, 0, 1}, 2] +
x^38 Subscript[{0, 1, 1, 0, 1, 0, 1, 0}, 2] +
x^23 Subscript[{0, 1, 1, 0, 1, 1, 0, 1}, 2] +
x^35 Subscript[{0, 1, 1, 0, 1, 1, 0, 1}, 2] +
x^14 Subscript[{0, 1, 1, 1, 0, 0, 0, 1}, 2] +
x^26 Subscript[{0, 1, 1, 1, 0, 0, 1, 1}, 2] +
x^33 Subscript[{0, 1, 1, 1, 1, 0, 0, 1}, 2] +
x^3 Subscript[{0, 1, 1, 1, 1, 1, 0, 1}, 2] +
x^15 Subscript[{0, 1, 1, 1, 1, 1, 0, 1}, 2] +
x^16 Subscript[{1, 0, 0, 0, 0, 1, 0, 0}, 2] +
x^18 Subscript[{1, 0, 0, 0, 0, 1, 0, 1}, 2] +
x^22 Subscript[{1, 0, 0, 0, 0, 1, 1, 0}, 2] +
x^36 Subscript[{1, 0, 0, 1, 1, 0, 0, 1}, 2] +
x^34 Subscript[{1, 0, 0, 1, 1, 0, 1, 0}, 2] +
x^7 Subscript[{1, 0, 0, 1, 1, 1, 1, 1}, 2] +
x^27 Subscript[{1, 0, 1, 0, 0, 1, 0, 0}, 2] +
x^20 Subscript[{1, 0, 1, 0, 1, 0, 0, 0}, 2] +
x^44 Subscript[{1, 0, 1, 1, 1, 1, 0, 0}, 2] +
x^5 Subscript[{1, 1, 0, 0, 1, 0, 1, 0}, 2] +
x^40 Subscript[{1, 1, 0, 0, 1, 0, 1, 0}, 2] +
x^43 Subscript[{1, 1, 0, 0, 1, 0, 1, 0}, 2] +
x^25 Subscript[{1, 1, 0, 1, 1, 1, 0, 1}, 2] +
x Subscript[{1, 1, 0, 1, 1, 1, 1, 0}, 2] +
x^39 Subscript[{1, 1, 0, 1, 1, 1, 1, 1}, 2] +
x^41 Subscript[{1, 1, 0, 1, 1, 1, 1, 1}, 2] +
x^24 Subscript[{1, 1, 1, 0, 0, 0, 0, 0}, 2] +
x^45 Subscript[{1, 1, 1, 0, 0, 1, 0, 0}, 2] +
x^2 Subscript[{1, 1, 1, 0, 1, 1, 0, 0}, 2] +
x^31 Subscript[{1, 1, 1, 1, 0, 0, 0, 0}, 2] +
x^42 Subscript[{1, 1, 1, 1, 0, 0, 0, 0}, 2])}
I'missed only the x-free polynomial in y to transform back.
Sincerely
Udo.