def test_ea_permutations(): for N in [4, 5]: F = GF(2**N, name="a") inv = [(F.fetch_int(x)**(2**N - 2)).integer_representation() for x in xrange(0, 2**N)] print("== " + str(N)) for L in ea_equivalent_permutation_mappings(inv): print(L.str() + "\n")
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_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
total = 0 for f in ea_classes_in_the_ccz_class_of(kim): print( str(algebraic_degree(f)) + pretty_spectrum(thickness_spectrum(f))) total += 1 print("total: " + str(total)) # !SECTION! Running tests if __name__ == '__main__': # test_ea_permutations() # test_ccz_permutations(number="just one") # test_enumerate_ea() # test_ea_classes() # import sys # N = int(sys.argv[1]) # print("=== Linear Equivalence ===") # test_le_equivalence(N, verbose=True) # print("\n=== Linear Representative ===") # test_le_repr(N, verbose=False) # print("\n=== Affine Equivalence ===") # test_ae_equivalence(N, verbose=True) N = 5 gf = GF(2**N, name="a") cube = [(gf.fetch_int(x)**3) for x in range(0, 2**N)] for g in ea_classes_in_the_ccz_class_of(cube): print(are_ccz_equivalent(f, g), g)