From dc826454d087bd9a5d73010a5e33b5b304d6f4ba Mon Sep 17 00:00:00 2001 From: sharwan Date: Fri, 31 May 2024 12:34:15 +0200 Subject: [PATCH] Fixed doctests in sbox_component.py --- claasp/components/sbox_component.py | 81 +++--- claasp/editor.py | 365 +--------------------------- 2 files changed, 48 insertions(+), 398 deletions(-) diff --git a/claasp/components/sbox_component.py b/claasp/components/sbox_component.py index 921bbdee..6b5cc958 100644 --- a/claasp/components/sbox_component.py +++ b/claasp/components/sbox_component.py @@ -759,27 +759,28 @@ def milp_large_xor_differential_probability_constraints(self, binary_variable, i EXAMPLES:: - sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher + sage: from claasp.ciphers.block_ciphers.present_block_cipher import PresentBlockCipher sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel sage: from sage.crypto.sbox import SBox - sage: aes = AESBlockCipher(number_of_rounds=3) - sage: milp = MilpModel(aes) + sage: present = PresentBlockCipher(number_of_rounds=3) + sage: milp = MilpModel(present) sage: milp.init_model_in_sage_milp_class() - sage: sbox_component = aes.component_from(0, 1) + sage: sbox_component = present.component_from(0, 1) sage: from claasp.cipher_modules.models.milp.utils.generate_inequalities_for_large_sboxes import delete_dictionary_that_contains_inequalities_for_large_sboxes sage: delete_dictionary_that_contains_inequalities_for_large_sboxes() - sage: variables, constraints = sbox_component.milp_large_xor_differential_probability_constraints(milp.binary_variable, milp.integer_variable, milp._non_linear_component_id) # long - ... - sage: variables # long - [('x[xor_0_0_0]', x_0), - ('x[xor_0_0_1]', x_1), + sage: variables, constraints = sbox_component.milp_large_xor_differential_probability_constraints(milp.binary_variable, milp.integer_variable, milp._non_linear_component_id) ... - ('x[sbox_0_1_6]', x_14), - ('x[sbox_0_1_7]', x_15)] - sage: constraints[:3] # long - [x_0 + x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 <= 8*x_16, - 1 - x_0 - x_1 - x_2 - x_3 - x_4 - x_5 - x_6 - x_7 <= 8 - 8*x_16, - x_8 <= x_16] + sage: variables + [('x[xor_0_0_0]', x_0), + ('x[xor_0_0_1]', x_1), + ... + ('x[sbox_0_1_2]', x_6), + ('x[sbox_0_1_3]', x_7)] + sage: constraints[:3] + [x_0 + x_1 + x_2 + x_3 <= 4*x_8, + 1 - x_0 - x_1 - x_2 - x_3 <= 4 - 4*x_8, + x_4 <= x_8] + """ x = binary_variable @@ -863,9 +864,9 @@ def milp_small_xor_differential_probability_constraints(self, binary_variable, i """ Return a list of variables and a list of constrains modeling a component of type SBOX. - .. NOTE:: + NOTE:: - This is for MILP small xor differential probability. Constraints extracted from + This is for MILP small xor differential probability. Constraints extracted from https://eprint.iacr.org/2014/747.pdf and https://tosc.iacr.org/index.php/ToSC/article/view/805/759 INPUT: @@ -893,10 +894,10 @@ def milp_small_xor_differential_probability_constraints(self, binary_variable, i ('x[sbox_0_1_3]', x_7)] sage: constraints [x_8 <= x_0 + x_1 + x_2 + x_3, - x_0 <= x_8, - ... - x_9 + x_10 == x_8, - x_11 == 30*x_9 + 20*x_10] + x_0 <= x_8, + ... + x_9 + x_10 == x_8, + x_11 == 300*x_9 + 200*x_10] """ x = binary_variable @@ -1040,13 +1041,12 @@ def milp_xor_differential_propagation_constraints(self, model): EXAMPLES:: sage: from claasp.ciphers.block_ciphers.present_block_cipher import PresentBlockCipher - sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel + sage: from claasp.cipher_modules.models.milp.milp_models.milp_xor_differential_model import MilpXorDifferentialModel sage: present = PresentBlockCipher(number_of_rounds=6) - sage: milp = MilpModel(present) + sage: milp = MilpXorDifferentialModel(present) sage: milp.init_model_in_sage_milp_class() sage: sbox_component = present.component_from(0, 1) sage: variables, constraints = sbox_component.milp_xor_differential_propagation_constraints(milp) - ... sage: variables [('x[xor_0_0_0]', x_0), ('x[xor_0_0_1]', x_1), @@ -1058,7 +1058,7 @@ def milp_xor_differential_propagation_constraints(self, model): 1 - x_0 - x_1 - x_2 - x_3 <= 4 - 4*x_8, ... x_9 + x_10 == x_8, - x_11 == 30*x_9 + 20*x_10] + x_11 == 300*x_9 + 200*x_10] """ binary_variable = model.binary_variable integer_variable = model.integer_variable @@ -1082,9 +1082,9 @@ def milp_xor_linear_mask_propagation_constraints(self, model): EXAMPLES:: sage: from claasp.ciphers.block_ciphers.present_block_cipher import PresentBlockCipher - sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel + sage: from claasp.cipher_modules.models.milp.milp_models.milp_xor_linear_model import MilpXorLinearModel sage: present = PresentBlockCipher(number_of_rounds=6) - sage: milp = MilpModel(present) + sage: milp = MilpXorLinearModel(present) sage: milp.init_model_in_sage_milp_class() sage: sbox_component = present.component_from(0, 1) sage: variables, constraints = sbox_component.milp_xor_linear_mask_propagation_constraints(milp) @@ -1096,8 +1096,8 @@ def milp_xor_linear_mask_propagation_constraints(self, model): ('x[sbox_0_1_2_o]', x_6), ('x[sbox_0_1_3_o]', x_7)] sage: constraints - [x_8 <= x_4 + x_5 + x_6 + x_7, - x_0 <= x_8, + [x_0 + x_1 + x_2 + x_3 <= 4*x_8, + 1 - x_0 - x_1 - x_2 - x_3 <= 4 - 4*x_8, ... x_9 + x_10 + x_11 + x_12 == x_8, x_13 == 200*x_9 + 100*x_10 + 100*x_11 + 200*x_12] @@ -1120,11 +1120,17 @@ def milp_wordwise_deterministic_truncated_xor_differential_constraints(self, mod 6 inequalities can enforce these transitions. They can either be computer using Sage with the Polyhedron class - sage: valid_points = [[0,0,0,0], [0,1,1,0],[1,0,1,0],[1,1,1,1]] - sage: from sage.geometry.polyhedron.constructor import Polyhedron - sage: Polyhedron(vertices=valid_points) - sage: for inequality in poly.Hrepresentation(): - ....: print(f'{inequality.repr_pretty()}') + + sage: valid_points = [[0,0,0,0], [0,1,1,0],[1,0,1,0],[1,1,1,1]] + sage: from sage.geometry.polyhedron.constructor import Polyhedron + sage: poly = Polyhedron(vertices=valid_points) + sage: for inequality in poly.Hrepresentation(): + ....: print(f'{inequality.repr_pretty()}') + x0 + x1 - x2 - x3 == 0 + x3 >= 0 + x0 - x3 >= 0 + x1 - x3 >= 0 + -x0 - x1 + x3 >= -1 or using espresso @@ -1150,10 +1156,9 @@ def milp_wordwise_deterministic_truncated_xor_differential_constraints(self, mod sage: constraints [x_0 + x_1 <= 1 + x_3, x_2 <= x_0 + x_1, - ... + ... x_1 <= x_2, x_0 <= x_2] - """ x = model.binary_variable @@ -1294,6 +1299,7 @@ def milp_undisturbed_bits_bitwise_deterministic_truncated_xor_differential_const sage: milp.init_model_in_sage_milp_class() sage: sbox_component = present.component_from(0,1) sage: variables, constraints = sbox_component.milp_undisturbed_bits_bitwise_deterministic_truncated_xor_differential_constraints(milp) + ... sage: variables [('x[xor_0_0_0_class_bit_0]', x_0), ('x[xor_0_0_0_class_bit_1]', x_1), @@ -1314,8 +1320,7 @@ def milp_undisturbed_bits_bitwise_deterministic_truncated_xor_differential_const sage: milp.init_model_in_sage_milp_class() sage: sbox_component = ascon.component_from(0, 3) sage: variables, constraints = sbox_component.milp_undisturbed_bits_bitwise_deterministic_truncated_xor_differential_constraints(milp) - - + ... """ x = model.binary_variable diff --git a/claasp/editor.py b/claasp/editor.py index a963c2fb..af507cf0 100644 --- a/claasp/editor.py +++ b/claasp/editor.py @@ -1651,46 +1651,7 @@ def remove_rotations(cipher): 'output_bit_size': 16, 'description': ['MODADD', 2, None], }, - { - # round = 0 - round component = 1 - 'id': 'xor_0_2', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_0_1', 'key'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 0 - round component = 2 - 'id': 'xor_0_4', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_0_2', 'plaintext'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 16, 17]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 0 - round component = 3 - 'id': 'intermediate_output_0_5', - 'type': 'intermediate_output', - 'input_bit_size': 16, - 'input_id_link': ['key'], - 'input_bit_positions': [[48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]], - 'output_bit_size': 16, - 'description': ['round_key_output'], - }, - { - # round = 0 - round component = 4 - 'id': 'intermediate_output_0_6', - 'type': 'intermediate_output', - 'input_bit_size': 32, - 'input_id_link': ['xor_0_2', 'xor_0_4'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 32, - 'description': ['round_output'], - }, + ... ], # round 1 [ @@ -1704,86 +1665,7 @@ def remove_rotations(cipher): 'output_bit_size': 16, 'description': ['0x0000'], }, - { - # round = 1 - round component = 1 - 'id': 'modadd_1_2', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['key', 'key'], - 'input_bit_positions': [[41, 42, 43, 44, 45, 46, 47, 32, 33, 34, 35, 36, 37, 38, 39, 40], [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 1 - round component = 2 - 'id': 'xor_1_3', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_1_2', 'constant_1_0'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 1 - round component = 3 - 'id': 'xor_1_5', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_1_3', 'key'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 48, 49]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 1 - round component = 4 - 'id': 'modadd_1_7', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_0_2', 'xor_0_4'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 1 - round component = 5 - 'id': 'xor_1_8', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_1_7', 'xor_1_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 1 - round component = 6 - 'id': 'xor_1_10', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_1_8', 'xor_0_4'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 1 - round component = 7 - 'id': 'intermediate_output_1_11', - 'type': 'intermediate_output', - 'input_bit_size': 16, - 'input_id_link': ['xor_1_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['round_key_output'], - }, - { - # round = 1 - round component = 8 - 'id': 'intermediate_output_1_12', - 'type': 'intermediate_output', - 'input_bit_size': 32, - 'input_id_link': ['xor_1_8', 'xor_1_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 32, - 'description': ['round_output'], - }, + ... ], # round 2 [ @@ -1797,86 +1679,7 @@ def remove_rotations(cipher): 'output_bit_size': 16, 'description': ['0x0001'], }, - { - # round = 2 - round component = 1 - 'id': 'modadd_2_2', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['key', 'xor_1_5'], - 'input_bit_positions': [[25, 26, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 24], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 2 - round component = 2 - 'id': 'xor_2_3', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_2_2', 'constant_2_0'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 2 - round component = 3 - 'id': 'xor_2_5', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_2_3', 'xor_1_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 2 - round component = 4 - 'id': 'modadd_2_7', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_1_8', 'xor_1_10'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 2 - round component = 5 - 'id': 'xor_2_8', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_2_7', 'xor_2_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 2 - round component = 6 - 'id': 'xor_2_10', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_2_8', 'xor_1_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 2 - round component = 7 - 'id': 'intermediate_output_2_11', - 'type': 'intermediate_output', - 'input_bit_size': 16, - 'input_id_link': ['xor_2_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['round_key_output'], - }, - { - # round = 2 - round component = 8 - 'id': 'intermediate_output_2_12', - 'type': 'intermediate_output', - 'input_bit_size': 32, - 'input_id_link': ['xor_2_8', 'xor_2_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 32, - 'description': ['round_output'], - }, + ... ], # round 3 [ @@ -1890,86 +1693,7 @@ def remove_rotations(cipher): 'output_bit_size': 16, 'description': ['0x0002'], }, - { - # round = 3 - round component = 1 - 'id': 'modadd_3_2', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['key', 'xor_2_5'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 3 - round component = 2 - 'id': 'xor_3_3', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_3_2', 'constant_3_0'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 3 - round component = 3 - 'id': 'xor_3_5', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_3_3', 'xor_2_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 3 - round component = 4 - 'id': 'modadd_3_7', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_2_8', 'xor_2_10'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 3 - round component = 5 - 'id': 'xor_3_8', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_3_7', 'xor_3_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 3 - round component = 6 - 'id': 'xor_3_10', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_3_8', 'xor_2_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 3 - round component = 7 - 'id': 'intermediate_output_3_11', - 'type': 'intermediate_output', - 'input_bit_size': 16, - 'input_id_link': ['xor_3_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['round_key_output'], - }, - { - # round = 3 - round component = 8 - 'id': 'intermediate_output_3_12', - 'type': 'intermediate_output', - 'input_bit_size': 32, - 'input_id_link': ['xor_3_8', 'xor_3_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 32, - 'description': ['round_output'], - }, + ... ], # round 4 [ @@ -1983,86 +1707,7 @@ def remove_rotations(cipher): 'output_bit_size': 16, 'description': ['0x0003'], }, - { - # round = 4 - round component = 1 - 'id': 'modadd_4_2', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_1_3', 'xor_3_5'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 4 - round component = 2 - 'id': 'xor_4_3', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_4_2', 'constant_4_0'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 4 - round component = 3 - 'id': 'xor_4_5', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_4_3', 'xor_3_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 4 - round component = 4 - 'id': 'modadd_4_7', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_3_8', 'xor_3_10'], - 'input_bit_positions': [[9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['MODADD', 2, None], - }, - { - # round = 4 - round component = 5 - 'id': 'xor_4_8', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['modadd_4_7', 'xor_4_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 4 - round component = 6 - 'id': 'xor_4_10', - 'type': 'word_operation', - 'input_bit_size': 32, - 'input_id_link': ['xor_4_8', 'xor_3_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1]], - 'output_bit_size': 16, - 'description': ['XOR', 2], - }, - { - # round = 4 - round component = 7 - 'id': 'intermediate_output_4_11', - 'type': 'intermediate_output', - 'input_bit_size': 16, - 'input_id_link': ['xor_4_5'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 16, - 'description': ['round_key_output'], - }, - { - # round = 4 - round component = 8 - 'id': 'cipher_output_4_12', - 'type': 'cipher_output', - 'input_bit_size': 32, - 'input_id_link': ['xor_4_8', 'xor_4_10'], - 'input_bit_positions': [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], - 'output_bit_size': 32, - 'description': ['cipher_output'], - }, + ... ], ], 'cipher_reference_code': None,