switch to BooleanPolynomialRing

This commit is contained in:
2026-04-20 14:19:24 +02:00
parent 587e5683e1
commit 501aa1043c
2 changed files with 12 additions and 29 deletions
+5 -4
View File
@@ -1,4 +1,4 @@
from sage.all import GF, PolynomialRing
from sage.all import GF, BooleanPolynomialRing
from tea3.constants import TEA3_SBOX, T_F1, T_F2
from tea3.pretty_print import pretty_print, pretty_print_vec
@@ -14,7 +14,8 @@ class Tea3Model:
[f"R{i}{j}" for i in range(8) for j in range(8)]
)
self.S = PolynomialRing(self.F, names)
name_string = ",".join(names)
self.S = BooleanPolynomialRing(len(names), name_string)
self.v = self.S.gens()
self.x_bits = [list(self.v[i*8:(i+1)*8]) for i in range(5)]
@@ -99,7 +100,7 @@ def G32(X, Y):
t = Tea3Model()
for i in range(3):
for i in range(4):
print("step "+str(i))
t.step()
print(pretty_print_vec(t.R_bits[0]))
print(pretty_print(t.R_bits[0][0]))