code: def check(self, r, k=None):
          '''Verifies the codeword is valid by testing that the codeword (message+ecc) as a polynomial code divides g
          returns True/False
          '''
          n = self.n
          if not k: k = self.k
          #h = self.h[k]
          g = self.g[k]
  
          # If we were given a string, convert to a list (important to support fields above 2^8)
          if isinstance(r, _str):
              r = [ord(x) for x in r]
  
          # Turn r into a polynomial
          c = Polynomial([GF2int(x) for x in r])
  
          # This works too, but takes longer. Both checks are just as valid.
          #return (c*h)%gtimesh == Polynomial(x0=0)
  
          # Since all codewords are multiples of g, checking that codeword c divides g
          # suffices for validating a codeword.
          return c % g == Polynomial(x0=0f check(self, r, k=None):
          '''Verifies the codeword is valid by testing that the codeword (message+ecc) as a polynomial code divides g
          returns True/False
          '''
          n = self.n
          if not k: k = self.k
          #h = self.h[k]
          g = self.g[k]
  
          # If we were given a string, convert to a list (important to support fields above 2^8)
          if isinstance(r, _str):
              r = [ord(x) for x in r]
  
          # Turn r into a polynomial
          c = Polynomial([GF2int(x) for x in r])
  
          # This works too, but takes longer. Both checks are just as valid.
          #return (c*h)%gtimesh == Polynomial(x0=0)
  
          # Since all codewords are multiples of g, checking that codeword c divides g
          # suffices for validating a codeword.
          return c % g == Polynomial(x0=0)
docs: Verifies the codeword is valid by testing that the codeword (message+ecc) as a polynomial code divides g
          returns True/False