Not component¶
- class NOT(current_round_number, current_round_number_of_components, input_id_links, input_bit_positions, output_bit_size)¶
Bases:
Component- algebraic_polynomials(model)¶
Return a list of polynomials for bitwise NOT.
INPUT:
model– model object; a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: from claasp.cipher_modules.models.algebraic.algebraic_model import AlgebraicModel sage: ascon = AsconPermutation(number_of_rounds=2) sage: algebraic = AlgebraicModel(ascon) sage: not_component = ascon.get_component_from_id("not_0_5") sage: not_component.algebraic_polynomials(algebraic) [not_0_5_y0 + not_0_5_x0 + 1, not_0_5_y1 + not_0_5_x1 + 1, not_0_5_y2 + not_0_5_x2 + 1, ... not_0_5_y61 + not_0_5_x61 + 1, not_0_5_y62 + not_0_5_x62 + 1, not_0_5_y63 + not_0_5_x63 + 1]
- 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 NOT operation in CMS CIPHER model.
See also
SAT standard of Cipher for the format.
INPUT:
None
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.cms_constraints() (['not_0_8_0', 'not_0_8_1', 'not_0_8_2', ... '-not_0_8_30 -xor_0_6_30', 'not_0_8_31 xor_0_6_31', '-not_0_8_31 -xor_0_6_31'])
- cms_xor_differential_propagation_constraints(model)¶
- cms_xor_linear_mask_propagation_constraints(model)¶
- cp_constraints()¶
Return lists of declarations and constraints for NOT component for CP CIPHER model.
INPUT:
None
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.cp_constraints() ([], ['constraint not_0_8[0] = (xor_0_6[0] + 1) mod 2;', ... 'constraint not_0_8[31] = (xor_0_6[31] + 1) mod 2;'])
- cp_deterministic_truncated_xor_differential_constraints(inverse=False)¶
Return lists of declarations and constraints for NOT for CP deterministic truncated xor differential model.
INPUT:
inverse– boolean (default: False)
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.cp_deterministic_truncated_xor_differential_constraints() ([], ['constraint not_0_8[0] = xor_0_6[0];', ... 'constraint not_0_8[31] = xor_0_6[31];'])
- cp_deterministic_truncated_xor_differential_trail_constraints()¶
- cp_xor_differential_first_step_constraints(model)¶
Return lists of declarations and constraints for NOT component for the CP xor differential first step model.
INPUT:
model– model object; a model instance
EXAMPLES:
sage: from claasp.ciphers.block_ciphers.aes_block_cipher import AESBlockCipher sage: from claasp.cipher_modules.models.cp.cp_model import CpModel sage: from claasp.components.not_component import NOT sage: aes = AESBlockCipher() sage: cp = CpModel(aes) sage: not_component = NOT(0, 18, ['sbox_0_2', 'sbox_0_6', 'sbox_0_10', 'sbox_0_14'], [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7]], 32) sage: not_component.cp_xor_differential_first_step_constraints(cp) (['array[0..3] of var 0..1: not_0_18;'], ['constraint not_0_18[0] = sbox_0_2[0];', 'constraint not_0_18[1] = sbox_0_6[0];', 'constraint not_0_18[2] = sbox_0_10[0];', 'constraint not_0_18[3] = sbox_0_14[0];'])
- cp_xor_differential_propagation_constraints(model=None)¶
Return lists of declarations and constraints for NOT component for CP xor differential.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.cp_xor_differential_propagation_constraints() ([], ['constraint not_0_8[0] = xor_0_6[0];', ... 'constraint not_0_8[31] = xor_0_6[31];'])
- cp_xor_differential_propagation_first_step_constraints(model)¶
- cp_xor_linear_mask_propagation_constraints(model=None)¶
Return lists of declarations and constraints for NOT component for CP xor linear model.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: ascon = AsconPermutation(number_of_rounds=1) sage: not_component = ascon.component_from(0, 5) sage: not_component.cp_xor_linear_mask_propagation_constraints() (['array[0..63] of var 0..1:not_0_5_i;', 'array[0..63] of var 0..1:not_0_5_o;'], ['constraint not_0_5_o[0]=not_0_5_i[0];', ... 'constraint not_0_5_o[63]=not_0_5_i[63];'])
- property description¶
- generic_sign_linear_constraints(inputs)¶
Return the constraints for finding the sign of an NOT component.
INPUT:
inputs– list; the input of the NOT component
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: from claasp.components.not_component import NOT sage: gift = GiftPermutation(number_of_rounds=1) sage: not_component = gift.component_from(0, 8) sage: inputs = [0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0] sage: not_component.generic_sign_linear_constraints(inputs) 1
- get_bit_based_vectorized_python_code(params, convert_output_to_bytes)¶
- get_byte_based_vectorized_python_code(params)¶
- get_graph_representation()¶
- get_word_operation_sign(sign, solution)¶
- property id¶
- property input_bit_positions¶
- property input_bit_size¶
- property input_id_links¶
- 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_constraints(model)¶
Returns a list of variables and a list of constraints for NOT component in deterministic truncated XOR differential model.
INPUTS:
component– dict, the NOT component in Graph Representation
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: cipher = GiftPermutation() sage: from claasp.cipher_modules.models.milp.milp_models.milp_bitwise_deterministic_truncated_xor_differential_model import MilpBitwiseDeterministicTruncatedXorDifferentialModel sage: milp = MilpBitwiseDeterministicTruncatedXorDifferentialModel(cipher) sage: milp.init_model_in_sage_milp_class() sage: not_component = cipher.component_from(0,8) sage: variables, constraints = not_component.milp_bitwise_deterministic_truncated_xor_differential_constraints(milp) sage: variables [('x_class[xor_0_6_0]', x_0), ('x_class[xor_0_6_1]', x_1), ... ('x_class[not_0_8_30]', x_62), ('x_class[not_0_8_31]', x_63)] sage: constraints [x_32 == x_0, x_33 == x_1, ... x_62 == x_30, x_63 == x_31]
- milp_constraints(model)¶
Return lists of variables and constraints for the NOT component for MILP CIPHER model.
INPUT:
model– model object; a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel sage: ascon = AsconPermutation() sage: milp = MilpModel(ascon) sage: milp.init_model_in_sage_milp_class() sage: not_component = ascon.component_from(0,5) sage: variables, constraints = not_component.milp_constraints(milp) sage: variables [('x[xor_0_2_0]', x_0), ('x[xor_0_2_1]', x_1), ... ('x[not_0_5_62]', x_126), ('x[not_0_5_63]', x_127)] sage: constraints [x_0 + x_64 == 1, x_1 + x_65 == 1, ... x_62 + x_126 == 1, x_63 + x_127 == 1]
- milp_xor_differential_propagation_constraints(model)¶
Return a list of variables and a list of constraints for the NOT component for MILP xor differential.
INPUT:
model– model object; a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel sage: ascon = AsconPermutation() sage: milp = MilpModel(ascon) sage: milp.init_model_in_sage_milp_class() sage: not_component = ascon.component_from(0,5) sage: variables, constraints = not_component.milp_xor_differential_propagation_constraints(milp) sage: variables [('x[xor_0_2_0]', x_0), ('x[xor_0_2_1]', x_1), ... ('x[not_0_5_62]', x_126), ('x[not_0_5_63]', x_127)] sage: constraints [x_64 == x_0, x_65 == x_1, ... x_126 == x_62, x_127 == x_63]
- milp_xor_linear_mask_propagation_constraints(model)¶
Return a list of variables and a list of constraints for the NOT component for MILP xor linear.
INPUT:
model– model object; a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: from claasp.cipher_modules.models.milp.milp_model import MilpModel sage: ascon = AsconPermutation() sage: milp = MilpModel(ascon) sage: milp.init_model_in_sage_milp_class() sage: not_component = ascon.component_from(0,5) sage: variables, constraints = not_component.milp_xor_linear_mask_propagation_constraints(milp) sage: variables [('x[not_0_5_0_i]', x_0), ('x[not_0_5_1_i]', x_1), ... ('x[not_0_5_62_o]', x_126), ('x[not_0_5_63_o]', x_127)] sage: constraints [x_64 == x_0, x_65 == x_1, ... x_126 == x_62, x_127 == x_63]
- 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 for NOT in SAT DETERMINISTIC TRUNCATED XOR DIFFERENTIAL model.
See also
SAT standard of Cipher for the format.
INPUT:
None
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.sat_bitwise_deterministic_truncated_xor_differential_constraints() (['not_0_8_0_0', 'not_0_8_1_0', 'not_0_8_2_0', ... 'xor_0_6_30_0 -xor_0_6_30_1 -not_0_8_30_1', 'xor_0_6_31_0 xor_0_6_31_1 not_0_8_31_1', 'xor_0_6_31_0 -xor_0_6_31_1 -not_0_8_31_1'])
- sat_constraints()¶
Return a list of variables and a list of clauses for NOT operation in SAT CIPHER model.
See also
SAT standard of Cipher for the format.
INPUT:
None
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.sat_constraints() (['not_0_8_0', 'not_0_8_1', 'not_0_8_2', ... '-not_0_8_30 -xor_0_6_30', 'not_0_8_31 xor_0_6_31', '-not_0_8_31 -xor_0_6_31'])
- sat_xor_differential_propagation_constraints(model=None)¶
Return a list of variables and a list of clauses for NOT operation in SAT xor differential.
See also
SAT standard of Cipher for the format.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.sat_xor_differential_propagation_constraints() (['not_0_8_0', 'not_0_8_1', 'not_0_8_2', ... 'xor_0_6_30 -not_0_8_30', 'not_0_8_31 -xor_0_6_31', 'xor_0_6_31 -not_0_8_31'])
- sat_xor_linear_mask_propagation_constraints(model=None)¶
Return a list of variables and a list of clauses for NOT operation in SAT XOR LINEAR model.
See also
SAT standard of Cipher for the format.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.gift_permutation import GiftPermutation sage: gift = GiftPermutation(number_of_rounds=3) sage: not_component = gift.component_from(0, 8) sage: not_component.sat_xor_linear_mask_propagation_constraints() (['not_0_8_0_i', 'not_0_8_1_i', 'not_0_8_2_i', ... 'not_0_8_30_o -not_0_8_30_i', 'not_0_8_31_i -not_0_8_31_o', 'not_0_8_31_o -not_0_8_31_i'])
- select_bits(code)¶
- select_words(code, word_size, input=True)¶
- set_description(description)¶
- set_id(id_string)¶
- set_input_bit_positions(bit_positions)¶
- set_input_id_links(input_id_links)¶
- smt_constraints()¶
Return a variable list and SMT-LIB list asserts for NOT operation for SMT CIPHER model.
INPUT:
None
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: ascon = AsconPermutation(number_of_rounds=3) sage: not_component = ascon.component_from(0, 5) sage: not_component.smt_constraints() (['not_0_5_0', 'not_0_5_1', ... 'not_0_5_62', 'not_0_5_63'], ['(assert (distinct not_0_5_0 xor_0_2_0))', '(assert (distinct not_0_5_1 xor_0_2_1))', ... '(assert (distinct not_0_5_62 xor_0_2_62))', '(assert (distinct not_0_5_63 xor_0_2_63))'])
- smt_xor_differential_propagation_constraints(model=None)¶
Return a variable list and SMT-LIB list asserts for NOT operation SMT xor differential.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: ascon = AsconPermutation(number_of_rounds=3) sage: not_component = ascon.component_from(0, 5) sage: not_component.smt_xor_differential_propagation_constraints() (['not_0_5_0', 'not_0_5_1', ... 'not_0_5_62', 'not_0_5_63'], ['(assert (= not_0_5_0 xor_0_2_0))', '(assert (= not_0_5_1 xor_0_2_1))', ... '(assert (= not_0_5_62 xor_0_2_62))', '(assert (= not_0_5_63 xor_0_2_63))'])
- smt_xor_linear_mask_propagation_constraints(model=None)¶
Return a list of variables and a list of clauses for NOT operation in SMT XOR LINEAR model.
INPUT:
model– model object (default: None); a model instance
EXAMPLES:
sage: from claasp.ciphers.permutations.ascon_permutation import AsconPermutation sage: ascon = AsconPermutation(number_of_rounds=3) sage: not_component = ascon.component_from(0, 5) sage: not_component.smt_xor_linear_mask_propagation_constraints() (['not_0_5_0_i', 'not_0_5_1_i', ... 'not_0_5_62_o', 'not_0_5_63_o'], ['(assert (= not_0_5_0_i not_0_5_0_o))', '(assert (= not_0_5_1_i not_0_5_1_o))', ... '(assert (= not_0_5_62_i not_0_5_62_o))', '(assert (= not_0_5_63_i not_0_5_63_o))'])
- property suffixes¶
- property type¶