from src.models import DarcKey, DarcKeyTypes if __name__ == "__main__": height = 10 width = 7 # B_o_m # 2 Outer (Mutual) (Substitution) Function Key outer_mutual_substitution_function_key = DarcKey(matrix=[['9', '7', '4', '2', '5', '3', '0', '6', '1', '8']], key_type=DarcKeyTypes.outer_shuffle) # 3 Outer (Mutual) (Substitution) Function Function Key outer_mutual_substitution_function_function_key = DarcKey(matrix=[['8', '1', '4', '5', '2', '3', '7', '6', '0', '9']], key_type=DarcKeyTypes.outer_shuffle) # 4 Outer Server (Mutual) Shuffle (Permutation) Function Key outer_mutual_shuffle_permutation_function_key = DarcKey(matrix=[['3', '9', '2', '5', '0', '7', '6', '8', '1', '4']], key_type=DarcKeyTypes.outer_shuffle) # 5 Outer Client Shuffle (Permutation) Key outer_client_shuffle_permutation_key = DarcKey(matrix=[['6', '4', '7', '8', '0', '2', '1', '9', '5', '3']], key_type=DarcKeyTypes.outer_shuffle) # 6 Outer Client Shuffle (Permutation) Function Key outer_client_shuffle_permutation_function_key = DarcKey(matrix=[['4', '2', '1', '0', '5', '7', '8', '9', '3', '6']], key_type=DarcKeyTypes.outer_shuffle) # 7 Outer Server Shuffle (Permutation) Key outer_server_shuffle_permutation_key = DarcKey(matrix=[['4', '9', '6', '0', '7', '5', '3', '1', '2', '8']], key_type=DarcKeyTypes.outer_shuffle) # 15 Outer (Mutual) (Substitution) Function ephemeral Key outer_mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ ['0', '9', '6', '2', '1', '5', '3', '8', '7', '4'] ], key_type=DarcKeyTypes.outer_shuffle) # 16 Outer (Mutual) (Substitution) Function Function ephemeral Key outer_mutual_substitution_function_function_ephemeral_key = DarcKey(matrix=[ ['2', '3', '9', '7', '6', '0', '1', '4', '8', '5'] ], key_type=DarcKeyTypes.outer_shuffle) # 17 Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key outer_server_mutual_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ ['0', '8', '5', '9', '7', '3', '1', '4', '6', '2'] ], key_type=DarcKeyTypes.outer_shuffle) # 18 Outer Client Shuffle (Permutation) ephemeral Key outer_client_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ ['1', '4', '2', '9', '5', '7', '8', '3', '0', '6'] ], key_type=DarcKeyTypes.outer_shuffle) # 19 Outer Client Shuffle (Permutation) Function ephemeral Key outer_client_shuffle_permutation_function_ephemeral_key = DarcKey(matrix=[ ['4', '3', '2', '5', '1', '6', '7', '8', '0', '9'] ], key_type=DarcKeyTypes.outer_shuffle) # 20 Outer Server Shuffle (Permutation) ephemeral Key outer_server_shuffle_permutation_ephemeral_key = DarcKey(matrix=[ ['7', '5', '2', '1', '8', '4', '3', '6', '9', '0'] ], key_type=DarcKeyTypes.outer_shuffle) # 29 Alphabet Input Sequence the message alphabet_input_sequence = DarcKey(matrix=[ ['0', '2', '4', '6', '8', '1', '3', '5', '7', '9'] ], key_type=DarcKeyTypes.outer_shuffle) # 1 Alphabet Values alphabet_values = DarcKey(matrix=[ ['10', '28', '38', '41', '51', '64', '70'], ['15', '25', '33', '48', '56', '69', '71'], ['13', '22', '36', '47', '54', '60', '72'], ['12', '24', '31', '43', '58', '63', '73'], ['11', '21', '39', '49', '53', '65', '74'], ['18', '20', '32', '45', '52', '61', '75'], ['14', '29', '37', '44', '57', '68', '76'], ['19', '23', '34', '40', '59', '62', '77'], ['17', '27', '35', '42', '55', '67', '78'], ['16', '26', '30', '46', '50', '66', '79'] ], key_type=DarcKeyTypes.alphabet) # 8 (Mutual) (Substitution) Function Key mutual_substitution_function_key = DarcKey(matrix=[ ['1', '5', '0', '2', '3', '6', '4'], ['5', '2', '6', '4', '1', '3', '0'], ['4', '2', '3', '5', '6', '1', '0'], ['0', '3', '1', '6', '5', '2', '4'], ['4', '1', '3', '0', '6', '5', '2'], ['6', '3', '4', '2', '5', '1', '0'], ['2', '3', '0', '4', '1', '6', '5'], ['4', '0', '6', '5', '2', '3', '1'], ['3', '2', '4', '1', '0', '5', '6'], ['2', '3', '4', '1', '5', '0', '6'] ], key_type=DarcKeyTypes.inner_shuffle) # 9 Client Shuffle (Permutation) Key X client_shuffle_permutation_key_x = DarcKey(matrix=[ ['6', '3', '1', '4', '5', '0', '2'], ['6', '5', '0', '2', '3', '4', '1'], ['1', '4', '0', '6', '3', '2', '5'], ['6', '1', '4', '5', '3', '2', '0'], ['2', '0', '1', '4', '3', '5', '6'], ['3', '0', '6', '2', '1', '4', '5'], ['3', '2', '0', '1', '6', '4', '5'], ['6', '2', '3', '0', '1', '5', '4'], ['3', '0', '6', '5', '4', '1', '2'], ['3', '2', '5', '0', '4', '1', '6'] ], key_type=DarcKeyTypes.inner_shuffle) # 10 Client Shuffle (Permutation) Key A (remove A) client_shuffle_permutation_key_a = DarcKey(matrix=[ ['6', '0', '3', '5', '2', '1', '4'], ['4', '3', '2', '5', '0', '1', '6'], ['5', '4', '1', '0', '2', '3', '6'], ['3', '6', '1', '4', '5', '2', '0'], ['3', '5', '4', '2', '0', '1', '6'], ['6', '1', '5', '4', '2', '3', '0'], ['0', '4', '6', '3', '5', '1', '2'], ['0', '6', '4', '3', '1', '2', '5'], ['5', '0', '6', '3', '4', '1', '2'], ['3', '2', '0', '4', '1', '6', '5'] ], key_type=DarcKeyTypes.inner_shuffle) # 11 Server Shuffle (Permutation) Key server_shuffle_permutation_key = DarcKey(matrix=[ ['5', '2', '3', '0', '6', '4', '1'], ['5', '2', '6', '3', '0', '1', '4'], ['1', '3', '5', '0', '2', '6', '4'], ['6', '2', '1', '4', '5', '0', '3'], ['2', '3', '4', '1', '5', '6', '0'], ['3', '2', '0', '1', '5', '4', '6'], ['2', '6', '0', '3', '4', '1', '5'], ['3', '0', '4', '6', '2', '5', '1'], ['5', '3', '2', '0', '6', '4', '1'], ['1', '4', '5', '3', '2', '6', '0'] ], key_type=DarcKeyTypes.inner_shuffle) # 21 (Mutual) (Substitution) Function ephemeral Key mutual_substitution_function_ephemeral_key = DarcKey(matrix=[ ['6', '0', '1', '4', '2', '3', '5'], ['2', '3', '6', '4', '0', '1', '5'], ['2', '4', '0', '3', '6', '1', '5'], ['0', '4', '2', '3', '1', '5', '6'], ['6', '4', '2', '5', '1', '0', '3'], ['5', '1', '0', '6', '4', '2', '3'], ['1', '2', '4', '3', '6', '0', '5'], ['6', '1', '4', '0', '5', '3', '2'], ['2', '3', '5', '4', '6', '0', '1'], ['1', '6', '4', '3', '5', '2', '0'] ], key_type=DarcKeyTypes.inner_shuffle) # 22 Client Shuffle (Permutation) ephemeral Key A (remove A) client_shuffle_permutation_ephemeral_key_a = DarcKey(matrix=[ ['5', '0', '4', '3', '2', '6', '1'], ['0', '6', '2', '1', '5', '3', '4'], ['1', '2', '0', '3', '5', '4', '6'], ['0', '2', '6', '3', '4', '5', '1'], ['5', '1', '2', '0', '3', '4', '6'], ['1', '0', '3', '4', '5', '6', '2'], ['3', '0', '5', '2', '6', '4', '1'], ['6', '4', '5', '3', '0', '2', '1'], ['2', '4', '6', '0', '3', '5', '1'], ['4', '6', '2', '3', '5', '1', '0'] ], key_type=DarcKeyTypes.inner_shuffle) # 23 Server Shuffle (Permutation) ephemeral Key 1 (remove 1) server_shuffle_permutation_ephemeral_key_1 = DarcKey(matrix=[ ['6', '1', '3', '0', '4', '2', '5'], ['3', '2', '1', '0', '4', '5', '6'], ['2', '4', '3', '5', '0', '6', '1'], ['4', '1', '3', '6', '0', '2', '5'], ['1', '4', '2', '3', '0', '5', '6'], ['6', '4', '5', '0', '2', '3', '1'], ['0', '4', '2', '3', '1', '5', '6'], ['0', '6', '3', '5', '1', '2', '4'], ['2', '6', '3', '1', '4', '5', '0'], ['5', '0', '4', '1', '6', '3', '2'] ], key_type=DarcKeyTypes.inner_shuffle) # 12 Shared (Mutual) (Substitution) Component 1 shared_mutual_substitution_component_1 = DarcKey(matrix=[ ['81', '150', '209', '32', '246', '219', '15'], ['100', '15', '50', '179', '52', '1', '142'], ['98', '34', '170', '6', '195', '115', '117'], ['205', '169', '12', '151', '139', '91', '114'], ['192', '153', '175', '62', '249', '230', '103'], ['56', '54', '44', '107', '125', '122', '219'], ['28', '16', '32', '27', '95', '248', '200'], ['152', '121', '40', '198', '19', '55', '59'], ['189', '227', '175', '102', '171', '135', '170'], ['182', '144', '202', '64', '253', '89', '196'] ], key_type=DarcKeyTypes.alphabet) # 13 Client (Substitution) Key client_substitution_key = DarcKey(matrix=[ ['148', '232', '147', '96', '20', '201', '150'], ['120', '0', '158', '250', '176', '223', '82'], ['12', '81', '193', '212', '247', '100', '1'], ['127', '211', '164', '202', '25', '149', '34'], ['214', '38', '10', '197', '195', '97', '193'], ['177', '120', '199', '180', '206', '184', '155'], ['154', '146', '186', '205', '190', '47', '169'], ['164', '80', '233', '207', '214', '91', '108'], ['123', '101', '231', '244', '92', '88', '12'], ['222', '193', '85', '98', '224', '145', '0'] ], key_type=DarcKeyTypes.alphabet) # 14 Server (Substitution) Key server_substitution_key = DarcKey(matrix=[ ['163', '247', '59', '226', '186', '179', '35'], ['140', '180', '54', '88', '40', '252', '97'], ['229', '247', '16', '206', '186', '125', '81'], ['221', '222', '54', '22', '190', '18', '122'], ['126', '130', '83', '142', '152', '238', '237'], ['76', '168', '77', '176', '198', '119', '104'], ['121', '96', '80', '75', '138', '219', '122'], ['92', '210', '20', '56', '232', '219', '245'], ['111', '1', '155', '236', '15', '184', '0'], ['36', '31', '143', '5', '112', '206', '106'] ], key_type=DarcKeyTypes.alphabet ) # 24 Server (Substitution) ephemeral Unique Component Function server_substitution_ephemeral_unique_component_function = 5 # 25 Shared (Mutual) (Substitution) ephemeral Key shared_mutual_substitution_ephemeral_key = DarcKey(matrix=[ ['106', '113', '9', '54', '49', '4', '207'], ['184', '3', '232', '179', '15', '113', '142'], ['129', '44', '164', '54', '1', '32', '201'], ['106', '50', '246', '140', '149', '179', '109'], ['210', '11', '69', '193', '77', '245', '62'], ['37', '76', '137', '24', '220', '30', '165'], ['40', '57', '147', '225', '24', '176', '103'], ['37', '212', '189', '203', '218', '138', '168'], ['73', '227', '38', '164', '20', '239', '24'], ['7', '194', '254', '76', '0', '244', '215'] ], key_type=DarcKeyTypes.alphabet) # 26 Client (Substitution) ephemeral Key client_substitution_ephemeral_key = DarcKey(matrix=[ ['21', '149', '75', '73', '228', '81', '79'], ['41', '189', '80', '209', '45', '101', '53'], ['139', '238', '141', '159', '30', '79', '214'], ['239', '234', '72', '75', '80', '190', '124'], ['203', '225', '246', '200', '205', '195', '92'], ['201', '185', '113', '101', '176', '216', '106'], ['14', '210', '125', '70', '53', '128', '57'], ['115', '27', '97', '39', '199', '26', '104'], ['29', '4', '55', '5', '13', '57', '19'], ['158', '184', '137', '0', '221', '12', '217'] ], key_type=DarcKeyTypes.alphabet) # 27 Server (Substitution) ephemeral Random Component server_substitution_ephemeral_random_component = DarcKey(matrix=[ ['191', '50', '229', '60', '201', '64', '45'], ['31', '88', '90', '8', '153', '6', '228'], ['117', '63', '38', '90', '236', '207', '254'], ['64', '219', '36', '3', '119', '205', '171'], ['172', '138', '153', '52', '161', '137', '216'], ['49', '150', '210', '129', '174', '190', '54'], ['81', '230', '135', '200', '218', '31', '52'], ['128', '253', '177', '220', '1', '83', '3'], ['204', '199', '43', '50', '148', '215', '6'], ['79', '124', '128', '30', '74', '242', '85'] ], key_type=DarcKeyTypes.alphabet) # 28 Server (Substitution) ephemeral Unique Component server_substitution_ephemeral_unique_component = DarcKey(matrix=[ ['7', '190', '58', '75', '135', '15', '214', '149', '244', '224'] ], key_type=DarcKeyTypes.alphabet) # 30 Shared (Mutual) (Substitution) Key shared_mutual_substitution_key = shared_mutual_substitution_component_1 ^ client_substitution_key # 31 Outer (Mutual) Function Function ephemeral Key Applied = Outer (Mutual) (Substitution) Function Function Key << Outer (Mutual) (Substitution) Function Function ephemeral Key outer_mutual_function_function_ephemeral_key_applied = outer_mutual_substitution_function_function_key << outer_mutual_substitution_function_function_ephemeral_key # 32 Inner (Mutual) Function Applied Key = (Mutual) (Substitution) Function Key << (Mutual) (Substitution) Function ephemeral Key inner_mutual_function_applied_key = mutual_substitution_function_key << mutual_substitution_function_ephemeral_key # 33 Inner (Mutual) Function Key Scratch = Inner (Mutual) Function Applied Key << Outer (Mutual) Function Function ephemeral Key Applied inner_mutual_function_key_scratch = inner_mutual_function_applied_key < outer_mutual_function_function_ephemeral_key_applied # 34 Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied = Outer Server (Mutual) Shuffle (Permutation) Function Key << Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied = outer_mutual_shuffle_permutation_function_key << outer_server_mutual_shuffle_permutation_function_ephemeral_key # 35 Client Shuffle (Permutation) Key X Scratch = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied client_shuffle_permutation_key_x_scratch = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied # 36 Inner Function Key Scratch 2 = Inner (Mutual) Function Key Scratch << Client Shuffle (Permutation) Key X Scratch inner_function_key_scratch_2 = inner_mutual_function_key_scratch << client_shuffle_permutation_key_x_scratch # 37 Outer (Mutual) Function ephemeral Key Applied = Outer (Mutual) (Substitution) Function Key < Outer (Mutual) (Substitution) Function ephemeral Key outer_mutual_function_ephemeral_key_applied = outer_mutual_substitution_function_key << outer_mutual_substitution_function_ephemeral_key # 38 Server (Substitution) Key Scratch = Server (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied server_substitution_key_scratch = server_substitution_key < outer_mutual_function_ephemeral_key_applied # 39 Shared (Mutual) (Substitution) Key Scratch = Shared (Mutual) (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied shared_mutual_substitution_key_scratch = shared_mutual_substitution_key < outer_mutual_function_ephemeral_key_applied # 40 Shared (Mutual) (Substitution) ephemeral Key Server Scratch = Shared (Mutual) (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied shared_mutual_substitution_ephemeral_key_server_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied # line 78 # 41 Server Client Shuffle (Permutation) = Server Shuffle (Permutation) Key << Client Shuffle (Permutation) Key X server_client_shuffle_permutation = server_shuffle_permutation_key << client_shuffle_permutation_key_x # 42 Server Client Shuffle (Permutation) Inverse server_client_shuffle_permutation_inverse = ~server_client_shuffle_permutation # 43 Server Shuffle (Permutation) ephemeral Key 1 Inverse (remove 1) = ~(Server Shuffle (Permutation) ephemeral Key 1 (remove 1)) server_shuffle_permutation_ephemeral_key_1_inverse = ~server_shuffle_permutation_ephemeral_key_1 # 44 Server Shuffle (Permutation) ephemeral Key Applied = Server Client Shuffle (Permutation) Inverse < Server Shuffle (Permutation) ephemeral Key 1 Inverse (remove 1) server_shuffle_permutation_ephemeral_key_applied = server_client_shuffle_permutation_inverse << server_shuffle_permutation_ephemeral_key_1_inverse # line 82 # 45 Server Shuffle (Permutation) ephemeral Key Applied Scratch = Server Shuffle (Permutation) ephemeral Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied server_shuffle_permutation_ephemeral_key_applied_scratch = server_shuffle_permutation_ephemeral_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied # 46 Server Shuffle (Permutation) ephemeral Key Applied Scratch Inverse = ~Server Shuffle (Permutation) ephemeral Key Applied Scratch server_shuffle_permutation_ephemeral_key_applied_scratch_inverse = ~server_shuffle_permutation_ephemeral_key_applied_scratch # 47 Outer Server Shuffle (Permutation) ephemeral Key Applied = Outer Server Shuffle (Permutation) Key < Outer Server Shuffle (Permutation) ephemeral Key outer_server_shuffle_permutation_ephemeral_key_applied = outer_server_shuffle_permutation_key << outer_server_shuffle_permutation_ephemeral_key # 48 Alphabet Scratch 1 = Alphabet Values < Outer Server Shuffle (Permutation) ephemeral Key Applied alphabet_scratch_1 = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied # 49 Alphabet Scratch 2 = Alphabet Scratch 1 << Server Shuffle (Permutation) ephemeral Key Applied Scratch Inverse alphabet_scratch_2 = alphabet_scratch_1 << server_shuffle_permutation_ephemeral_key_applied_scratch_inverse # 50 Server (Substitution) ephemeral Component Scratch 1 = Server (Substitution) ephemeral Random Component.column_substitution( Server (Substitution) ephemeral Unique Component Function ,Server (Substitution) ephemeral Unique Component) server_substitution_ephemeral_component_scratch_1 = server_substitution_ephemeral_random_component.column_substitution( server_substitution_ephemeral_unique_component_function, server_substitution_ephemeral_unique_component.matrix[0] ) # 51 Server (Substitution) ephemeral Component Scratch 2 = Server (Substitution) ephemeral Component Scratch 1 < Outer (Mutual) Function ephemeral Key Applied server_substitution_ephemeral_component_scratch_2 = server_substitution_ephemeral_component_scratch_1 < outer_mutual_function_ephemeral_key_applied # 52 Server (Substitution) ephemeral Component Scratch 3 = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Component Scratch 2 << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2) server_substitution_ephemeral_component_scratch_3 = alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_component_scratch_2 << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) # 52 Inner Function Key Scratch 2 Inverse = ~Inner Function Key Scratch 2 inner_function_key_scratch_2_inverse = ~inner_function_key_scratch_2 # 54 Server (Substitution) ephemeral Key Scratch = Server (Substitution) ephemeral Component Scratch 3 << Inner Function Key Scratch 2 Inverse server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_component_scratch_3 << inner_function_key_scratch_2_inverse # 55 Outer (Mutual) Function ephemeral Key Applied Inverse = ~Outer (Mutual) Function ephemeral Key Applied outer_mutual_function_ephemeral_key_applied_inverse = ~outer_mutual_function_ephemeral_key_applied # 56 Server (Substitution) ephemeral Key = Server (Substitution) ephemeral Key Scratch < Outer (Mutual) Function ephemeral Key Applied Inverse server_substitution_ephemeral_key = server_substitution_ephemeral_key_scratch < outer_mutual_function_ephemeral_key_applied_inverse # line 94 """ Server Tx (Phase 1) """ # 57 Inner Server Shuffle (Permutation) Key Applied = Server Shuffle (Permutation) ephemeral Key 1 (remove 1) << Server Shuffle (Permutation) Key inner_server_shuffle_permutation_key_applied = server_shuffle_permutation_ephemeral_key_1 << server_shuffle_permutation_key # 58 Outer Server Shuffle (Permutation) Key Applied = Inner Server Shuffle (Permutation) Key Applied < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied outer_server_shuffle_permutation_key_applied = inner_server_shuffle_permutation_key_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied # 59 Server (Substitution) ephemeral Key Scratch = Server (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied server_substitution_ephemeral_key_scratch = server_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied # 86 Outer Shuffle (Permutation) = Alphabet Values << Outer Server Shuffle (Permutation) ephemeral Key Applied #outer_shuffle_permutation = alphabet_values < outer_server_shuffle_permutation_ephemeral_key_applied ## 87 Inner Shuffle (Permutation) = Outer Shuffle (Permutation) << Outer Server Shuffle (Permutation) Key Applied #inner_shuffle_permutation = outer_shuffle_permutation << outer_server_shuffle_permutation_key_applied ## 88 Translation (Substitution) = Inner Shuffle (Permutation) ^ (Server (Substitution) ephemeral Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Server (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) #translation_substitution = inner_shuffle_permutation ^ ( # server_substitution_ephemeral_key_scratch << inner_mutual_function_key_scratch) ^ ( # server_substitution_key_scratch << inner_mutual_function_key_scratch) # line 108 """ Client Rx (Phase 2) """ # 62 Client (Substitution) Key A Scratch = Client (Substitution) Key < Outer (Mutual) Function ephemeral Key Applied client_substitution_key_a_scratch = client_substitution_key < outer_mutual_function_ephemeral_key_applied # 63 Client (Substitution) ephemeral Key A Scratch = Client (Substitution) ephemeral Key < Outer (Mutual) Function ephemeral Key Applied client_substitution_ephemeral_key_a_scratch = client_substitution_ephemeral_key < outer_mutual_function_ephemeral_key_applied # 64 Client Shuffle (Permutation) Key A Applied (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) << Client Shuffle (Permutation) ephemeral Key A (remove A) client_shuffle_permutation_key_a_applied = client_shuffle_permutation_key_a << client_shuffle_permutation_ephemeral_key_a # 65 Client Shuffle (Permutation) Key A Scratch (remove A) = Client Shuffle (Permutation) Key A Applied (remove A) < Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied client_shuffle_permutation_key_a_scratch = client_shuffle_permutation_key_a_applied < outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied # 66 Outer Client Shuffle (Permutation) ephemeral Key Applied = Outer Client Shuffle (Permutation) Key << Outer Client Shuffle (Permutation) ephemeral Key outer_client_shuffle_permutation_ephemeral_key_applied = outer_client_shuffle_permutation_key << outer_client_shuffle_permutation_ephemeral_key # 67 Outer Client Shuffle (Permutation) Function ephemeral Key Applied = Outer Client Shuffle (Permutation) Function Key << Outer Client Shuffle (Permutation) Function ephemeral Key outer_client_shuffle_permutation_function_ephemeral_key_applied = outer_client_shuffle_permutation_function_key << outer_client_shuffle_permutation_function_ephemeral_key # 68 Outer Client Shuffle (Permutation) Function Key Applied = Outer Client Shuffle (Permutation) ephemeral Key Applied << Outer Client Shuffle (Permutation) Function ephemeral Key Applied outer_client_shuffle_permutation_function_key_applied = outer_client_shuffle_permutation_ephemeral_key_applied << outer_client_shuffle_permutation_function_ephemeral_key_applied # 69 Outer Client Shuffle (Permutation) Function Key Applied Inverse = ~Outer Client Shuffle (Permutation) Function Key Applied outer_client_shuffle_permutation_function_key_applied_inverse = ~outer_client_shuffle_permutation_function_key_applied # 70 Alphabet Input Sequence Scratch = Outer Client Shuffle (Permutation) Function Key Applied Inverse << Alphabet Input Sequence alphabet_input_sequence_scratch = outer_client_shuffle_permutation_function_key_applied_inverse << alphabet_input_sequence # 89 Translation (Substitution) - Client Data = Translation (Substitution) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) Key A Scratch << Inner (Mutual) Function Key Scratch) ^ (Client (Substitution) ephemeral Key A Scratch << Inner (Mutual) Function Key Scratch) #translation_substitution_client_data = translation_substitution ^ ( # shared_mutual_substitution_key_scratch << inner_mutual_function_key_scratch) ^ ( # client_substitution_key_a_scratch << inner_mutual_function_key_scratch) ^ ( # client_substitution_ephemeral_key_a_scratch << inner_mutual_function_key_scratch) ## 90 Inner Shuffle (Permutation) - CSKA+CSEKA = Translation (Substitution) - Client Data << Client Shuffle (Permutation) Key A Scratch (remove A) #inner_shuffle_permutation_cska_cseka = translation_substitution_client_data << client_shuffle_permutation_key_a_scratch ## 91 Outer Shuffle (Permutation) - Client Rest = Inner Shuffle (Permutation) - CSKA+CSEKA << Outer Client Shuffle (Permutation) Function Key Applied #outer_shuffle_permutation_client_rest = inner_shuffle_permutation_cska_cseka < outer_client_shuffle_permutation_function_key_applied # line 130 """ Client Tx (Phase 3) """ # 71 Client Shuffle (Permutation) Key A Inverse (remove A) = ~Client Shuffle (Permutation) Key A (remove A) client_shuffle_permutation_key_a_inverse = ~client_shuffle_permutation_key_a # 72 Client Shuffle (Permutation) Key B (remove B) = Client Shuffle (Permutation) Key A Inverse (remove A) << Client Shuffle (Permutation) Key X client_shuffle_permutation_key_b = client_shuffle_permutation_key_a_inverse << client_shuffle_permutation_key_x # 73 Client Shuffle (Permutation) ephemeral Key A (remove A) Inverse = ~Client Shuffle (Permutation) ephemeral Key A (remove A) client_shuffle_permutation_ephemeral_key_a_inverse = ~client_shuffle_permutation_ephemeral_key_a # 74 Client Shuffle (Permutation) Key B Applied = Client Shuffle (Permutation) ephemeral Key B << Client Shuffle (Permutation) Key B (remove B) client_shuffle_permutation_key_b_applied = client_shuffle_permutation_ephemeral_key_a_inverse << client_shuffle_permutation_key_b # 75 Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch = Outer Server (Mutual) Shuffle (Permutation) Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied outer_server_mutual_shuffle_permutation_function_key_scratch = outer_server_mutual_shuffle_permutation_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied # 76 Client Shuffle (Permutation) Key B Scratch = Client Shuffle (Permutation) Key B Applied < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch client_shuffle_permutation_key_b_scratch = client_shuffle_permutation_key_b_applied < outer_server_mutual_shuffle_permutation_function_key_scratch # 77 Client Shuffle (Permutation) Key X Scratch 2 = Client Shuffle (Permutation) Key X < Outer Server (Mutual) Shuffle (Permutation) Function Key Scratch client_shuffle_permutation_key_x_scratch_2 = client_shuffle_permutation_key_x < outer_server_mutual_shuffle_permutation_function_key_scratch # line 144 # 78 Outer Function Function Key Scratch = Outer (Mutual) Function Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied outer_function_function_key_scratch = outer_mutual_function_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied # 79 Inner (Mutual) Function Key Client Scratch = Inner (Mutual) Function Applied Key < Outer Function Function Key Scratch inner_mutual_function_key_client_scratch = inner_mutual_function_applied_key < outer_function_function_key_scratch # line 147 # 80 (Mutual) Function Key Scratch 2 = Inner (Mutual) Function Key Client Scratch << client_shuffle_permutation_key_x_scratch_2 mutual_function_key_scratch_2 = inner_mutual_function_key_client_scratch << client_shuffle_permutation_key_x_scratch_2 # 81 Outer (Mutual) Function Key Scratch = Outer (Mutual) Function ephemeral Key Applied << Outer Client Shuffle (Permutation) Function Key Applied outer_mutual_function_key_scratch = outer_mutual_function_ephemeral_key_applied << outer_client_shuffle_permutation_function_key_applied # 82 Client (Substitution) Key B Scratch = Client (Substitution) Key < Outer (Mutual) Function Key Scratch client_substitution_key_b_scratch = client_substitution_key < outer_mutual_function_key_scratch # 83 Client (Substitution) ephemeral Key B Scratch = Client (Substitution) ephemeral Key < Outer (Mutual) Function Key Scratch client_substitution_ephemeral_key_b_scratch = client_substitution_ephemeral_key < outer_mutual_function_key_scratch # 84 Shared (Mutual) (Substitution) ephemeral Key Client Scratch = Shared (Mutual) (Substitution) ephemeral Key < Outer (Mutual) Function Key Scratch shared_mutual_substitution_ephemeral_key_client_scratch = shared_mutual_substitution_ephemeral_key < outer_mutual_function_key_scratch # 92 Inner Shuffle (Permutation) - CSEKB +CSKB = Outer Shuffle (Permutation) - Client Rest << Client Shuffle (Permutation) Key B Scratch #inner_shuffle_permutation_csekb_cskb = outer_shuffle_permutation_client_rest << client_shuffle_permutation_key_b_scratch ## 93 Translation (Substitution) DARC Data = Inner Shuffle (Permutation) - CSEKB +CSKB ^ (Client (Substitution) Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Client (Substitution) ephemeral Key B Scratch << (Mutual) Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Client Scratch << (Mutual) Function Key Scratch 2) #translation_substitution_darc_data = inner_shuffle_permutation_csekb_cskb ^ ( # client_substitution_key_b_scratch << mutual_function_key_scratch_2) ^ ( # client_substitution_ephemeral_key_b_scratch << mutual_function_key_scratch_2) ^ ( # shared_mutual_substitution_ephemeral_key_client_scratch << mutual_function_key_scratch_2) # line 175 """ Server Rx (Phase 4) """ # 85 Translation (Substitution) = Alphabet Scratch 2 ^ (Server (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Server (Substitution) ephemeral Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) Key Scratch << Inner Function Key Scratch 2) ^ (Shared (Mutual) (Substitution) ephemeral Key Server Scratch << Inner Function Key Scratch 2) translation_substitution = ( alphabet_scratch_2 ^ (server_substitution_key_scratch << inner_function_key_scratch_2) ^ (server_substitution_ephemeral_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_key_scratch << inner_function_key_scratch_2) ^ (shared_mutual_substitution_ephemeral_key_server_scratch << inner_function_key_scratch_2) ) a = 1