diff --git a/src/gf256.py b/src/gf256.py --- a/src/gf256.py +++ b/src/gf256.py @@ -26,3 +26,12 @@ def ffmul(a, b): t=L[a]+L[b] if t>255: t-=255 return E[t] + + +def evaluate(coefs,x): + res=0 + xK=1 + for a in coefs: + res^=ffmul(a,xK) + xK=ffmul(xK,x) + return res