Exemplo n.º 1
0
 def create_verify_poly(self):
     ext_gen_poly = Poly(self.gen_poly.size + 1, self.gen_poly.deg, self.gen_poly.coeff_list)
     gen_field_coef = [0 for i in range(0, self.size + 1)]
     gen_field_coef[0] = 1
     gen_field_coef[self.size] = 1
     gen_field_poly = Poly(self.size + 1, self.size, gen_field_coef)
     [divider_poly, new_poly] = gen_field_poly.divide_polynomials(ext_gen_poly)
     return divider_poly
Exemplo n.º 2
0
 def convert_to_unicode(self, correct_line):
     unicode_str = str()
     count = len(correct_line) // self.size
     for i in range(0, count):
         last_one = 0
         coeff_list = list()
         for j in range(0, self.size):
             if (correct_line[i * self.size + j] == '1'):
                 coeff_list.append(1)
                 last_one = j
             else:
                 coeff_list.append(0)
         curr_poly = Poly(self.size, last_one, coeff_list)
         [divider_poly, rem_poly] = curr_poly.divide_polynomials(self.gen_poly)
         for r in range(0, self.k):
             unicode_str += str(divider_poly.coeff_list[r])
     return unicode_str