diff --git a/claasp/cipher_modules/models/cp/mzn_models/mzn_deterministic_truncated_xor_differential_model.py b/claasp/cipher_modules/models/cp/mzn_models/mzn_deterministic_truncated_xor_differential_model.py index 9ced27d3..a0533f67 100644 --- a/claasp/cipher_modules/models/cp/mzn_models/mzn_deterministic_truncated_xor_differential_model.py +++ b/claasp/cipher_modules/models/cp/mzn_models/mzn_deterministic_truncated_xor_differential_model.py @@ -435,10 +435,10 @@ def output_inverse_constraints(self, component): return cp_declarations, cp_constraints - def propagate_deterministically(self, component, wordwise=False): + def propagate_deterministically(self, component, wordwise=False, inverse=False): if not wordwise: if component.type == SBOX: - variables, constraints, sbox_mant = component.cp_deterministic_truncated_xor_differential_trail_constraints(self.sbox_mant) + variables, constraints, sbox_mant = component.cp_deterministic_truncated_xor_differential_trail_constraints(self.sbox_mant, inverse) self.sbox_mant = sbox_mant else: variables, constraints = component.cp_deterministic_truncated_xor_differential_trail_constraints() diff --git a/claasp/cipher_modules/models/cp/mzn_models/mzn_impossible_xor_differential_model.py b/claasp/cipher_modules/models/cp/mzn_models/mzn_impossible_xor_differential_model.py index 72b76ce5..707426a3 100644 --- a/claasp/cipher_modules/models/cp/mzn_models/mzn_impossible_xor_differential_model.py +++ b/claasp/cipher_modules/models/cp/mzn_models/mzn_impossible_xor_differential_model.py @@ -65,7 +65,7 @@ def build_impossible_backward_model(self, backward_components, clean = True): constant_components, constant_ids = self.extract_constants() for component in backward_components: if check_if_implemented_component(component): - variables, constraints = self.propagate_deterministically(component) + variables, constraints = self.propagate_deterministically(component, inverse=True) inverse_variables.extend(variables) inverse_constraints.extend(constraints) @@ -924,4 +924,4 @@ def solve(self, model_type, solver_name=None, number_of_rounds=None, initial_rou 'impossible_xor_differential_one_solution']: return solutions[0] else: - return solutions \ No newline at end of file + return solutions