Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 8800
Kernel: SageMath 9.5

Finding exceptional bent functions in the CAST128 S-boxes

Only a small number of the 8×32=2568 \times 32 = 256 bent functions in the CAST128 S-boxes have fewer than 217=1310722^{17} = 131072 Cayley classes in the union of their Extended Translation class and its dual. The code in this notebook finds these bent functions.

Import the required modules

import datetime import os import sqlite3 from boolean_cayley_graphs.bent_function import BentFunction from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification

Using saved CAST128 classifcations, find the exceptional bent functions.

sobj_dirname=os.path.join("..","sobj") exceptions = [] max_len_cayley_graph_class_list = 2 ** 17 then = datetime.datetime.now() for i in range(1,9): print(i) stri = "%01d" % i for j in range(32): strj = "%02d" % j sobj_name = "cast128_" + stri + "_" + str(j) + ".sobj" cgc = BentFunctionCayleyGraphClassification.load_mangled( sobj_name, dir=sobj_dirname) len_cayley_graph_class_list = len(cgc.cayley_graph_class_list) if len_cayley_graph_class_list < max_len_cayley_graph_class_list: exceptions.append((i,j)) now = datetime.datetime.now() print(stri, strj, now, now - then, len_cayley_graph_class_list) then = now print(exceptions)
1 2 2 01 2023-01-22 17:35:59.209772 0:04:58.706344 8256 2 16 2023-01-22 17:38:01.334311 0:02:02.124539 65536 3 4 4 27 2023-01-22 17:48:44.514829 0:10:43.180518 65536 5 5 16 2023-01-22 17:51:34.786826 0:02:50.271997 66560 5 27 2023-01-22 17:53:04.571871 0:01:29.785045 6144 6 6 17 2023-01-22 17:56:23.275130 0:03:18.703259 65536 7 7 15 2023-01-22 18:00:32.579023 0:04:09.303893 65536 7 21 2023-01-22 18:01:17.083889 0:00:44.504866 65536 8 [(2, 1), (2, 16), (4, 27), (5, 16), (5, 27), (6, 17), (7, 15), (7, 21)]