def gf_mul(f, g, p, K):
 df = gf_degree(f)
 dg = gf_degree(g)
 dh = (df + dg)
 h = ([0] * (dh + 1))
 for i in range(0, (dh + 1)):
  coeff = K.zero
  for j in range(max(0, (i - dg)), (min(i, df) + 1)):
   coeff += (f[j] * g[(i - j)])
  h[i] = (coeff % p)
 return gf_strip(h)

def gf_mul ( f , g , p , K ) : df = gf_degree ( f ) dg = gf_degree ( g ) dh = ( df + dg ) h = ( [ 0 ] * ( dh + 1 ) ) for i in range ( 0 , ( dh + 1 ) ) : coeff = K . zero for j in range ( max ( 0 , ( i - dg ) ) , ( min ( i , df ) + 1 ) ) : coeff += ( f [ j ] * g [ ( i - j ) ] ) h [ i ] = ( coeff % p ) return gf_strip ( h )
multiply polynomials in gf(p)[x] .