def _test(self): from sage.all import GF, PolynomialRing, proof k = GF(4, 'u') u = k.gen() R = PolynomialRing(k, 'v') v = R.gen() l = R.quo(v**3 + v + 1) v = l.gen() R = PolynomialRing(l, 'x,y') x, y = R.gens() f = y**3 + x**3 + (u + 1) * x with proof.WithProof('polynomial', False): f.factor()
def test_enumerate_ea(): N = 8 F = GF(2**N, name="a") # generating the Kim mapping kim = [] for x_i in xrange(0, 2**N): x = F.fetch_int(x_i) y = x**3 + x**10 + F.gen()*x**24 kim.append(y.integer_representation()) classes = enumerate_ea_classes(kim) for f in classes: print algebraic_degree(f), pretty_spectrum(thickness_spectrum(f)) print "total: ", len(classes)
def _test(self): from sage.all import GF, FunctionField, PolynomialRing k = GF(4) a = k.gen() R = PolynomialRing(k, 'b') b = R.gen() l = k.extension(b**2 + b + a, 'b') K = FunctionField(l, 'x') x = K.gen() R = PolynomialRing(K, 't') t = R.gen() F = t * x F.factor(proof=False)
def test_ccz_permutations(number="all permutations"): N = 6 F = GF(2**N, name="a") # generating the Kim mapping kim = [] for x_i in xrange(0, 2**N): x = F.fetch_int(x_i) y = x**3 + x**10 + F.gen() * x**24 kim.append(y.integer_representation()) permutations = ccz_equivalent_permutations(kim, number=number) for i, p in enumerate(permutations): print("{:2d} {} {} {}".format( i, is_permutation(p), pretty_spectrum(differential_spectrum(p)), pretty_vector(p))) print("total: {}".format(len(permutations)))
def test_ea_classes(): N = 8 F = GF(2**N, name="a") # generating the Kim mapping kim = [] for x_i in xrange(0, 2**N): x = F.fetch_int(x_i) y = x**3 + x**10 + F.gen()*x**24 kim.append(y.integer_representation()) total = 0 for f in ea_classes_in_the_ccz_class_of(kim): print algebraic_degree(f), pretty_spectrum(thickness_spectrum(f)) total += 1 print "total: ", total
"""Contains many 8-bit APN functions""" from sage.all import GF, PolynomialRing # global variables of the module N = 8 F = GF(2**N, name="a") g = F.gen() POLY_RING = PolynomialRing(F, "X") X = POLY_RING.gen() def poly_to_lut(p): s = [] for x_i in xrange(0, 2**N): y = (p(F.fetch_int(x_i))).integer_representation() s.append(y) return s def all_quadratic_polynomials(): """All the functions in Table 9 of http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.215.5432&rep=rep1&type=pdf """ return [ poly_to_lut(X**3), poly_to_lut(X**9), poly_to_lut(X**3 + sum(X**(9 * 2**i) for i in xrange(0, N))), poly_to_lut(X**9 + sum(X**(3 * 2**i) for i in xrange(0, N))), poly_to_lut(X**3 + g**245 * X**33 + g**183 * X**66 + g**21 * X**144),