Skip to content

Commit

Permalink
Added missing condition in evaluate_vectorized
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgerault committed Apr 28, 2024
1 parent ee0b981 commit 734b53d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion claasp/cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,4 +1708,12 @@ def get_descendants_subgraph(G, start_nodes):

def update_input_id_links_from_component_id(self, component_id, new_input_id_links):
round_number = self.get_round_from_component_id(component_id)
self._rounds.rounds[round_number].update_input_id_links_from_component_id(component_id, new_input_id_links)
self._rounds.rounds[round_number].update_input_id_links_from_component_id(component_id, new_input_id_links)

def all_sboxes_are_standard(self):
for comp in self.get_all_components():
if 'sbox' in comp.id:
if (comp.input_bit_size != comp.output_bit_size) or (comp.input_bit_size % 2 != 0) or (
comp.output_bit_size % 2 != 0):
return False
return True
2 changes: 1 addition & 1 deletion claasp/cipher_modules/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def evaluate_using_c(cipher, inputs, intermediate_output, verbosity):


def evaluate_vectorized(cipher, cipher_input, intermediate_outputs=False, verbosity=False):
if np.any(np.array(cipher.inputs_bit_size) % 8 != 0):
if np.any(np.array(cipher.inputs_bit_size) % 8 != 0) or not cipher.all_sboxes_are_standard():
python_code_string = code_generator \
.generate_bit_based_vectorized_python_code_string(cipher,
store_intermediate_outputs=intermediate_outputs,
Expand Down

0 comments on commit 734b53d

Please sign in to comment.