Mix column component

class MixColumn(current_round_number, current_round_number_of_components, input_id_links, input_bit_positions, output_bit_size, description)

Bases: LinearLayer

algebraic_polynomials(model)

Return a list of polynomials for MIX COLUMN operation.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: from claasp.cipher_modules.models.algebraic.algebraic_model import AlgebraicModel
sage: midori = MidoriBlockCipher(number_of_rounds=16)
sage: mix_column = midori.get_component_from_id("mix_column_0_20")
sage: mix_column.algebraic_polynomials(AlgebraicModel(midori))
[mix_column_0_20_x0 + mix_column_0_20_y0,
 mix_column_0_20_x1 + mix_column_0_20_y1,
 mix_column_0_20_x2 + mix_column_0_20_y2,
 ...
 mix_column_0_20_y61^2 + mix_column_0_20_y61,
 mix_column_0_20_y62^2 + mix_column_0_20_y62,
 mix_column_0_20_y63^2 + mix_column_0_20_y63]
as_python_dictionary()
check_output_size(available_word_sizes, fixed, word_size)
cms_constraints()

Return a list of variables and a list of clauses for MIX COLUMN in CMS CIPHER model.

See also

SAT standard of Cipher for the format.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: mix_column_component.cms_constraints()
(['mix_column_0_23_0',
  'mix_column_0_23_1',
  'mix_column_0_23_2',
  ...
  '-mix_column_0_23_15 -mix_column_0_20_35 mix_column_0_20_39 -mix_column_0_20_43',
  '-mix_column_0_23_15 mix_column_0_20_35 -mix_column_0_20_39 -mix_column_0_20_43',
  'mix_column_0_23_15 -mix_column_0_20_35 -mix_column_0_20_39 -mix_column_0_20_43'])
cms_xor_differential_propagation_constraints(model)
cms_xor_linear_mask_propagation_constraints(model=None)

Return a list of variables and a list of clauses for LINEAR LAYER in CMS XOR LINEAR model.

See also

SAT standard of Cipher for the format.

INPUT:

  • modelmodel object (default: None); a model instance

EXAMPLES:

sage: from claasp.ciphers.toys.fancy_block_cipher import FancyBlockCipher
sage: fancy = FancyBlockCipher(number_of_rounds=3)
sage: linear_layer_component = fancy.component_from(0,6)
sage: linear_layer_component.cms_xor_linear_mask_propagation_constraints()
(['linear_layer_0_6_0_i',
  'linear_layer_0_6_1_i',
  'linear_layer_0_6_2_i',
  ...
  'x -linear_layer_0_6_21_o dummy_0_linear_layer_0_6_21_o dummy_1_linear_layer_0_6_21_o dummy_2_linear_layer_0_6_21_o dummy_3_linear_layer_0_6_21_o dummy_4_linear_layer_0_6_21_o dummy_5_linear_layer_0_6_21_o dummy_6_linear_layer_0_6_21_o dummy_8_linear_layer_0_6_21_o dummy_9_linear_layer_0_6_21_o dummy_10_linear_layer_0_6_21_o dummy_11_linear_layer_0_6_21_o dummy_12_linear_layer_0_6_21_o dummy_18_linear_layer_0_6_21_o dummy_19_linear_layer_0_6_21_o dummy_23_linear_layer_0_6_21_o',
  'x -linear_layer_0_6_22_o dummy_0_linear_layer_0_6_22_o dummy_1_linear_layer_0_6_22_o dummy_2_linear_layer_0_6_22_o dummy_3_linear_layer_0_6_22_o dummy_4_linear_layer_0_6_22_o dummy_6_linear_layer_0_6_22_o dummy_9_linear_layer_0_6_22_o dummy_13_linear_layer_0_6_22_o dummy_14_linear_layer_0_6_22_o dummy_15_linear_layer_0_6_22_o dummy_16_linear_layer_0_6_22_o dummy_19_linear_layer_0_6_22_o dummy_20_linear_layer_0_6_22_o dummy_21_linear_layer_0_6_22_o',
  'x -linear_layer_0_6_23_o dummy_1_linear_layer_0_6_23_o dummy_5_linear_layer_0_6_23_o dummy_7_linear_layer_0_6_23_o dummy_8_linear_layer_0_6_23_o dummy_9_linear_layer_0_6_23_o dummy_14_linear_layer_0_6_23_o dummy_17_linear_layer_0_6_23_o dummy_18_linear_layer_0_6_23_o dummy_23_linear_layer_0_6_23_o'])
cp_constraints()

Return lists of declarations and constraints for MIX COLUMN component for the CP cipher model.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: aes = AESBlockCipher(number_of_rounds=3)
sage: mix_column_component = aes.component_from(0, 21)
sage: mix_column_component.cp_constraints()
([],
 ['constraint mix_column_0_21[0] = (rot_0_17[1] + rot_0_18[0] + rot_0_18[1] + rot_0_19[0] + rot_0_20[0]) mod 2;',
  ...
  'constraint mix_column_0_21[31] = (rot_0_17[0] + rot_0_17[7] + rot_0_18[7] + rot_0_19[7] + rot_0_20[0]) mod 2;'])
cp_deterministic_truncated_xor_differential_constraints(inverse=False)

Return lists declarations and constraints for MIX COLUMN component for the CP deterministic truncated xor differential model.

INPUT:

  • inverseboolean (default: False)

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: aes = AESBlockCipher(number_of_rounds=3)
sage: mix_column_component = aes.component_from(0, 21)
sage: mix_column_component.cp_deterministic_truncated_xor_differential_constraints()
([],
 ['constraint if ((rot_0_17[1] < 2) /\\ (rot_0_18[0] < 2) /\\ (rot_0_18[1] < 2) /\\ (rot_0_19[0] < 2) /\\ (rot_0_20[0]< 2)) then mix_column_0_21[0] = (rot_0_17[1] + rot_0_18[0] + rot_0_18[1] + rot_0_19[0] + rot_0_20[0]) mod 2 else mix_column_0_21[0] = 2 endif;',
   ...
  'constraint if ((rot_0_17[0] < 2) /\\ (rot_0_17[7] < 2) /\\ (rot_0_18[7] < 2) /\\ (rot_0_19[7] < 2) /\\ (rot_0_20[0]< 2)) then mix_column_0_21[31] = (rot_0_17[0] + rot_0_17[7] + rot_0_18[7] + rot_0_19[7] + rot_0_20[0]) mod 2 else mix_column_0_21[31] = 2 endif;'])
cp_deterministic_truncated_xor_differential_trail_constraints()
cp_wordwise_deterministic_truncated_xor_differential_constraints(model)

Return lists declarations and constraints for LINEAR LAYER CP deterministic truncated xor differential model.

INPUT:

  • inverseboolean (default: False)

EXAMPLES:

sage: from claasp.ciphers.toys.fancy_block_cipher import FancyBlockCipher
sage: fancy = FancyBlockCipher(number_of_rounds=3)
sage: linear_layer_component = fancy.component_from(0, 6)
sage: linear_layer_component.cp_deterministic_truncated_xor_differential_constraints()
([],
 ['constraint if ((sbox_0_0[2] < 2) /\\ (sbox_0_0[3] < 2) /\\ (sbox_0_1[0] < 2) /\\ (sbox_0_1[1] < 2) /\\ (sbox_0_1[3] < 2) /\\ (sbox_0_2[0] < 2) /\\ (sbox_0_2[1] < 2) /\\ (sbox_0_3[1] < 2) /\\ (sbox_0_4[2] < 2) /\\ (sbox_0_5[1] < 2) /\\ (sbox_0_5[3]< 2)) then linear_layer_0_6[0] = (sbox_0_0[2] + sbox_0_0[3] + sbox_0_1[0] + sbox_0_1[1] + sbox_0_1[3] + sbox_0_2[0] + sbox_0_2[1] + sbox_0_3[1] + sbox_0_4[2] + sbox_0_5[1] + sbox_0_5[3]) mod 2 else linear_layer_0_6[0] = 2 endif;',
  ...
  'constraint if ((sbox_0_0[0] < 2) /\\ (sbox_0_0[1] < 2) /\\ (sbox_0_0[2] < 2) /\\ (sbox_0_0[3] < 2) /\\ (sbox_0_1[3] < 2) /\\ (sbox_0_2[1] < 2) /\\ (sbox_0_3[1] < 2) /\\ (sbox_0_3[2] < 2) /\\ (sbox_0_3[3] < 2) /\\ (sbox_0_4[1] < 2) /\\ (sbox_0_4[2] < 2) /\\ (sbox_0_4[3] < 2) /\\ (sbox_0_5[1] < 2) /\\ (sbox_0_5[2] < 2) /\\ (sbox_0_5[3]< 2)) then linear_layer_0_6[23] = (sbox_0_0[0] + sbox_0_0[1] + sbox_0_0[2] + sbox_0_0[3] + sbox_0_1[3] + sbox_0_2[1] + sbox_0_3[1] + sbox_0_3[2] + sbox_0_3[3] + sbox_0_4[1] + sbox_0_4[2] + sbox_0_4[3] + sbox_0_5[1] + sbox_0_5[2] + sbox_0_5[3]) mod 2 else linear_layer_0_6[23] = 2 endif;'])
cp_xor_differential_propagation_constraints(model)
cp_xor_differential_propagation_first_step_constraints(model)

Return declarations and constraints for MIX COLUMN component for the CP xor differential first step model.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: from claasp.cipher_modules.models.cp.mzn_model import MznModel
sage: aes = AESBlockCipher(number_of_rounds=3)
sage: cp = MznModel(aes)
sage: mix_column_component = aes.component_from(0, 21)
sage: mix_column_component.cp_xor_differential_propagation_first_step_constraints(cp)
(['array[0..3] of var 0..1: mix_column_0_21;',
  'array[0..93, 1..8] of int: mix_column_truncated_table_mix_column_0_21 = array2d(0..93, 1..8, [0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,1,1,0,0,1,0,1,1,1,1,0,1,0,0,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,0,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1]);'],
 ['constraint table([rot_0_17[0]]++[rot_0_18[0]]++[rot_0_19[0]]++[rot_0_20[0]]++[mix_column_0_21[0]]++[mix_column_0_21[1]]++[mix_column_0_21[2]]++[mix_column_0_21[3]], mix_column_truncated_table_mix_column_0_21);'])
cp_xor_linear_mask_propagation_constraints(model=None)

Return lists of declarations and constraints for MIX COLUMN component for the CP xor linear model.

INPUT:

  • modelmodel object (default: None); a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: aes = AESBlockCipher(number_of_rounds=3)
sage: mix_column_component = aes.component_from(0, 21)
sage: mix_column_component.cp_xor_linear_mask_propagation_constraints()
(['array[0..31] of var 0..1:mix_column_0_21_i;',
  'array[0..31] of var 0..1:mix_column_0_21_o;'],
 ['constraint mix_column_0_21_i[0]=(mix_column_0_21_o[1]+mix_column_0_21_o[2]+mix_column_0_21_o[3]+mix_column_0_21_o[8]+mix_column_0_21_o[9]+mix_column_0_21_o[11]+mix_column_0_21_o[16]+mix_column_0_21_o[18]+mix_column_0_21_o[19]+mix_column_0_21_o[24]+mix_column_0_21_o[27]) mod 2;',
  ...
  'constraint mix_column_0_21_i[31]=(mix_column_0_21_o[0]+mix_column_0_21_o[2]+mix_column_0_21_o[7]+mix_column_0_21_o[9]+mix_column_0_21_o[10]+mix_column_0_21_o[15]+mix_column_0_21_o[18]+mix_column_0_21_o[23]+mix_column_0_21_o[24]+mix_column_0_21_o[25]+mix_column_0_21_o[26]) mod 2;'])
property description
get_bit_based_c_code(verbosity)
get_bit_based_vectorized_python_code(params, convert_output_to_bytes)
get_byte_based_vectorized_python_code(params)
get_graph_representation()
property id
property input_bit_positions
property input_bit_size
is_forbidden(forbidden_types, forbidden_descriptions)
is_id_equal_to(component_id)
is_power_of_2_word_based(dto)
milp_bitwise_deterministic_truncated_xor_differential_binary_constraints(model)

Returns a list of variables and a list of constraints for linear layer component in deterministic truncated XOR differential model.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.permutations.ascon_sbox_sigma_permutation import AsconSboxSigmaPermutation
sage: from claasp.cipher_modules.models.milp.milp_models.milp_bitwise_deterministic_truncated_xor_differential_model import MilpBitwiseDeterministicTruncatedXorDifferentialModel
sage: ascon = AsconSboxSigmaPermutation(number_of_rounds=1)
sage: milp = MilpBitwiseDeterministicTruncatedXorDifferentialModel(ascon)
sage: milp.init_model_in_sage_milp_class()
sage: linear_layer_component = ascon.component_from(0, 68)
sage: variables, constraints = linear_layer_component.milp_bitwise_deterministic_truncated_xor_differential_binary_constraints(milp)
milp_bitwise_deterministic_truncated_xor_differential_constraints(model)

Returns a list of variables and a list of constraints for linear layer component in deterministic truncated XOR differential model.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.present_block_cipher import PresentBlockCipher
sage: from claasp.cipher_modules.models.milp.milp_models.milp_bitwise_deterministic_truncated_xor_differential_model import MilpBitwiseDeterministicTruncatedXorDifferentialModel
sage: present = PresentBlockCipher(number_of_rounds=6)
sage: milp = MilpBitwiseDeterministicTruncatedXorDifferentialModel(present)
sage: milp.init_model_in_sage_milp_class()
sage: linear_layer_component = present.component_from(0, 17)
sage: variables, constraints = linear_layer_component.milp_bitwise_deterministic_truncated_xor_differential_constraints(milp)
sage: variables
[('x_class[sbox_0_1_0]', x_0),
 ('x_class[sbox_0_1_1]', x_1),
 ...
 ('x_class[linear_layer_0_17_62]', x_126),
 ('x_class[linear_layer_0_17_63]', x_127)]
sage: constraints
[x_64 == x_0,
 x_65 == x_4,
 ...
 x_126 == x_59,
 x_127 == x_63]
milp_constraints(model)

Return lists of variables and constrains modeling a component of type MIX COLUMN for MILP CIPHER model.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel
sage: aes = AESBlockCipher(number_of_rounds=3)
sage: milp = MilpModel(aes)
sage: milp.init_model_in_sage_milp_class()
sage: mix_column_component = aes.component_from(0, 21)
sage: variables, constraints = mix_column_component.milp_constraints(milp)
...
sage: variables
[('x[rot_0_17_0]', x_0),
('x[rot_0_17_1]', x_1),
...
('x[mix_column_0_21_30]', x_62),
('x[mix_column_0_21_31]', x_63)]
sage: constraints[:3]
[1 <= 1 - x_1 + x_8 + x_9 + x_16 + x_24 + x_32,
 1 <= 1 + x_1 - x_8 + x_9 + x_16 + x_24 + x_32,
 1 <= 1 + x_1 + x_8 - x_9 + x_16 + x_24 + x_32]
milp_wordwise_deterministic_truncated_xor_differential_constraints(model)

Returns a list of variables and a list of constraints for mix column component in deterministic truncated XOR differential model.

For MDS matrices, this method implements Model 5 from https://tosc.iacr.org/index.php/ToSC/article/view/8702/8294 INPUTS:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher
sage: aes = AESBlockCipher(number_of_rounds=2)
sage: from claasp.cipher_modules.models.milp.milp_models.milp_wordwise_deterministic_truncated_xor_differential_model import MilpWordwiseDeterministicTruncatedXorDifferentialModel
sage: milp = MilpWordwiseDeterministicTruncatedXorDifferentialModel(aes)
sage: milp.init_model_in_sage_milp_class()
sage: mix_column_component = aes.component_from(0, 21)
sage: variables, constraints = mix_column_component.milp_wordwise_deterministic_truncated_xor_differential_constraints(milp) # random
sage: variables
[('x[rot_0_17_word_0_class_bit_0]', x_0),
 ('x[rot_0_17_word_0_class_bit_1]', x_1),
 ...
 ('x[mix_column_0_21_word_3_class_bit_0]', x_14),
 ('x[mix_column_0_21_word_3_class_bit_1]', x_15)]
sage: constraints
[1 <= 1 + x_0 + x_1 + x_2 + x_3 + x_4 + x_5 + x_6 - x_15,
 1 <= 1 + x_0 + x_1 + x_2 + x_3 + x_4 + x_5 + x_7 - x_15,
 ...
1 <= 1 - x_11 + x_13,
1 <= 1 - x_9 + x_11]

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: cipher = MidoriBlockCipher(number_of_rounds=2)
sage: from claasp.cipher_modules.models.milp.milp_models.milp_wordwise_deterministic_truncated_xor_differential_model import MilpWordwiseDeterministicTruncatedXorDifferentialModel
sage: milp = MilpWordwiseDeterministicTruncatedXorDifferentialModel(cipher)
sage: milp.init_model_in_sage_milp_class()
sage: mix_column_component = cipher.component_from(0, 21)
sage: variables, constraints = mix_column_component.milp_wordwise_deterministic_truncated_xor_differential_constraints(milp)
...
milp_xor_differential_propagation_constraints(model)
milp_xor_linear_mask_propagation_constraints(model)

Return lists of variables and constraints for MIX COLUMN component for MILP xor linear.

INPUT:

  • modelmodel object; a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel
sage: midori = MidoriBlockCipher()
sage: milp = MilpModel(midori)
sage: milp.init_model_in_sage_milp_class()
sage: mix_column_component = midori.component_from(0, 20)
sage: variables, constraints = mix_column_component.milp_xor_linear_mask_propagation_constraints(milp)
...
sage: variables
[('x[mix_column_0_20_0_i]', x_0),
 ('x[mix_column_0_20_1_i]', x_1),
...
 ('x[mix_column_0_20_62_o]', x_126),
 ('x[mix_column_0_20_63_o]', x_127)]

sage: constraints
[x_64 == x_0,
 x_65 == x_1,
...
x_126 == x_34,
x_127 == x_35]
property output_bit_size
output_size_for_concatenate(available_word_sizes, fixed, word_size)
print()
print_as_python_dictionary()
print_values(code)
print_word_values(code)
sat_bitwise_deterministic_truncated_xor_differential_constraints()

Return a list of variables and a list of clauses representing MIX COLUMN for SAT DETERMINISTIC TRUNCATED XOR DIFFERENTIAL model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

See also

SAT standard of Cipher for the format.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.sat_bitwise_deterministic_truncated_xor_differential_constraints()
sage: constraints[-1]
'mix_column_0_23_15_0 -inter_0_mix_column_0_23_15_1 -mix_column_0_20_43_1 -mix_column_0_23_15_1'
sat_constraints()

Return a list of variables and a list of clauses representing MIX COLUMN for SAT CIPHER model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

See also

SAT standard of Cipher for the format.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.sat_constraints()
sage: constraints[-1]
'mix_column_0_23_15 -mix_column_0_20_35 -mix_column_0_20_39 -mix_column_0_20_43'
sat_xor_differential_propagation_constraints(model=None)

Return a list of variables and a list of clauses representing MIX COLUMN for SAT XOR DIFFERENTIAL model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

See also

SAT standard of Cipher for the format.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.sat_xor_differential_propagation_constraints()
sage: constraints[-1]
'mix_column_0_23_15 -mix_column_0_20_35 -mix_column_0_20_39 -mix_column_0_20_43'
sat_xor_linear_mask_propagation_constraints(model=None)

Return a list of variables and a list of clauses representing MIX COLUMN for SAT XOR LINEAR model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

See also

SAT standard of Cipher for the format.

INPUT:

  • modelmodel object (default: None); a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.sat_xor_linear_mask_propagation_constraints()
sage: constraints[-1]
'mix_column_0_23_15_o -dummy_3_mix_column_0_23_15_o -dummy_7_mix_column_0_23_15_o -dummy_11_mix_column_0_23_15_o'
select_bits(code)
select_words(code, word_size, input=True)
set_description(description)
set_id(id_string)
set_input_bit_positions(bit_positions)
smt_constraints()

Return a variable list and SMT-LIB list asserts representing MIX COLUMN for SMT CIPHER model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.smt_constraints()
sage: constraints[-1]
'(assert (= mix_column_0_23_15 (xor mix_column_0_20_35 mix_column_0_20_39 mix_column_0_20_43)))'
smt_xor_differential_propagation_constraints(model=None)

Return a variable list and SMT-LIB list asserts representing MIX COLUMN for SMT XOR DIFFERENTIAL model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

INPUT:

  • None

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.smt_xor_differential_propagation_constraints()
sage: constraints[-1]
'(assert (= mix_column_0_23_15 (xor mix_column_0_20_35 mix_column_0_20_39 mix_column_0_20_43)))'
smt_xor_linear_mask_propagation_constraints(model=None)

Return a variable list and SMT-LIB list asserts representing MIX COLUMN for SMT XOR LINEAR model

The model is generated converting the MIX COLUMN compoment into a LINEAR LAYER and using the corresponding method.

INPUT:

  • modelmodel object (default: None); a model instance

EXAMPLES:

sage: from claasp.ciphers.block_ciphers.midori_block_cipher import MidoriBlockCipher
sage: midori = MidoriBlockCipher(number_of_rounds=3)
sage: mix_column_component = midori.component_from(0, 23)
sage: variables, constraints = mix_column_component.smt_xor_linear_mask_propagation_constraints()
sage: constraints[-1]
'(assert (= mix_column_0_23_15_o (xor dummy_3_mix_column_0_23_15_o dummy_7_mix_column_0_23_15_o dummy_11_mix_column_0_23_15_o)))'
property suffixes
property type
add_xor_components(word_size, output_id_link_1, output_id_link_2, output_size, list_of_xor_components)
calculate_input_bit_positions(word_size, word_index, input_name_1, input_name_2, new_input_bit_positions_1, new_input_bit_positions_2)
cp_get_all_inputs(word_size, input_bit_positions, input_id_link, numb_of_inp)