def lfsr_sequence(key, fill, n):
 if (not isinstance(key, list)):
  raise TypeError('key must be a list')
 if (not isinstance(fill, list)):
  raise TypeError('fill must be a list')
 p = key[0].mod
 F = FF(p)
 s = fill
 k = len(fill)
 L = []
 for i in range(n):
  s0 = s[:]
  L.append(s[0])
  s = s[1:k]
  x = sum([int((key[i] * s0[i])) for i in range(k)])
  s.append(F(x))
 return L

def lfsr_sequence ( key , fill , n ) : if ( not isinstance ( key , list ) ) : raise TypeError ( 'key must be a list' ) if ( not isinstance ( fill , list ) ) : raise TypeError ( 'fill must be a list' ) p = key [ 0 ] . mod F = FF ( p ) s = fill k = len ( fill ) L = [ ] for i in range ( n ) : s0 = s [ : ] L . append ( s [ 0 ] ) s = s [ 1 : k ] x = sum ( [ int ( ( key [ i ] * s0 [ i ] ) ) for i in range ( k ) ] ) s . append ( F ( x ) ) return L
this function creates an lfsr sequence .