def _div_gf2(a, b):
 if (a < b):
  return (0, a)
 deg = number.size
 q = 0
 r = a
 d = deg(b)
 while (deg(r) >= d):
  s = (1 << (deg(r) - d))
  q ^= s
  r ^= _mult_gf2(b, s)
 return (q, r)

def _div_gf2 ( a , b ) : if ( a < b ) : return ( 0 , a ) deg = number . size q = 0 r = a d = deg ( b ) while ( deg ( r ) >= d ) : s = ( 1 << ( deg ( r ) - d ) ) q ^= s r ^= _mult_gf2 ( b , s ) return ( q , r )
compute division of polynomials over gf(2) .