diff --git a/src/gf256.py b/src/gf256.py --- a/src/gf256.py +++ b/src/gf256.py @@ -35,3 +35,16 @@ def evaluate(coefs,x): res^=ffmul(a,xK) xK=ffmul(xK,x) return res + + +def getConstantCoef(k,*points): + res=0 + for i in range(k): + (x,y)=points[i] + prod=1 + for j in range(k): + if i==j: continue + (xj,yj)=points[j] + prod=ffmul(prod, (ffmul(xj,inv[xj^x]))) + res^=ffmul(y,prod) + return res